Fix type errors in all examples

This commit is contained in:
Rapptz
2025-08-16 05:21:19 -04:00
parent 7e2ca02fd1
commit 4f539b710f
26 changed files with 124 additions and 16 deletions

View File

@ -3,6 +3,9 @@ import asyncio
class MyClient(discord.Client):
# Suppress error on the User attribute being None since it fills up later
user: discord.ClientUser
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@ -18,9 +21,13 @@ class MyClient(discord.Client):
await self.wait_until_ready()
counter = 0
channel = self.get_channel(1234567) # channel ID goes here
# Tell the type checker that this is a messageable channel
assert isinstance(channel, discord.abc.Messageable)
while not self.is_closed():
counter += 1
await channel.send(counter)
await channel.send(str(counter))
await asyncio.sleep(60) # task runs every 60 seconds