mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-10-22 16:32:59 +00:00
Fix type errors in all examples
This commit is contained in:
@@ -18,6 +18,9 @@ bot = commands.Bot(command_prefix='?', description=description, intents=intents)
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
# Tell the type checker that User is filled up at this point
|
||||
assert bot.user is not None
|
||||
|
||||
print(f'Logged in as {bot.user} (ID: {bot.user.id})')
|
||||
print('------')
|
||||
|
||||
@@ -57,7 +60,11 @@ async def repeat(ctx, times: int, content='repeating...'):
|
||||
@bot.command()
|
||||
async def joined(ctx, member: discord.Member):
|
||||
"""Says when a member joined."""
|
||||
await ctx.send(f'{member.name} joined {discord.utils.format_dt(member.joined_at)}')
|
||||
# Joined at can be None in very bizarre cases so just handle that as well
|
||||
if member.joined_at is None:
|
||||
await ctx.send(f'{member} has no join date.')
|
||||
else:
|
||||
await ctx.send(f'{member} joined {discord.utils.format_dt(member.joined_at)}')
|
||||
|
||||
|
||||
@bot.group()
|
||||
|
Reference in New Issue
Block a user