diff options
author | 2020-12-13 11:20:13 +0100 | |
---|---|---|
committer | 2020-12-13 11:20:13 +0100 | |
commit | fb7838c6165b6b32f6561a871428330f9d8f0c7c (patch) | |
tree | 2d76758970c94a744b3465948df7acc8e975a01d /bot/__main__.py | |
parent | Merge branch 'master' into sebastiaan/advent-of-code/refactor-background-tasks (diff) |
Clarify comment on AoC Status Task startup delay
The Advent of Code Status Countdown task needs to wait for two things to
happen to prevent it from failing during the startup sequence:
1. The Websocket instance discord.py creates needs to be available as
an attribute of the bot, otherwise discord.py fails internally:
Traceback (most recent call last):
File "discord/client.py", line 1049, in change_presence
await self.ws.change_presence(
activity=activity, status=status, afk=afk
)
File "advent_of_code/_cog.py", line 52, in countdown_status
await bot.change_presence(activity=discord.Game(playing))
AttributeError: 'NoneType' object has no attribute 'change_presence'
2. Allegedly, according to the discord.py community, trying to change
the status too early in the sequence to establish a connection with
Discord may result ub the Discord API aborting the connection.
To solve this, I've added a `wait_until_guild_available` waiter, as it
guarantees that the websocket is available and the connections is
mature.
Kaizen: I've changed the name `new_puzzle_announcement` to
`new_puzzle_notification` to better reflect its function.
Diffstat (limited to 'bot/__main__.py')
0 files changed, 0 insertions, 0 deletions