Skip to content

Commit 3793035

Browse files
committed
Migrate to on_socket_event_type event
Discord.py 2.0 (Namely this commit Rapptz/discord.py@e2250d4) removed the socket_response event, and replaced it with the socket_event_type event, which just sends the type of event triggered on the websocket. Since this event was removed, no socket stats were being incremented, as the event never triggered. I have looked through the rest of the bot, and we do not use the socket_response event type anywhere else.
1 parent f047a70 commit 3793035

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bot/exts/utils/internal.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ def __init__(self, bot: Bot):
3737
self.eval.add_check(is_owner().predicate)
3838

3939
@Cog.listener()
40-
async def on_socket_response(self, msg: dict) -> None:
40+
async def on_socket_event_type(self, event_type: str) -> None:
4141
"""When a websocket event is received, increase our counters."""
42-
if event_type := msg.get("t"):
43-
self.socket_event_total += 1
44-
self.socket_events[event_type] += 1
42+
self.socket_event_total += 1
43+
self.socket_events[event_type] += 1
4544

4645
def _format(self, inp: str, out: Any) -> Tuple[str, Optional[discord.Embed]]:
4746
"""Format the eval output into a string & attempt to format it into an Embed."""

0 commit comments

Comments
 (0)