mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-07 10:22:59 +00:00
Fix type errors in all examples
This commit is contained in:
@ -4,6 +4,9 @@ import discord
|
||||
|
||||
|
||||
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)
|
||||
|
||||
@ -36,6 +39,9 @@ class MyClient(discord.Client):
|
||||
# Make sure the role still exists and is valid.
|
||||
return
|
||||
|
||||
# Tell the type checker that RawReactionActionEvent.member is not none during REACTION_ADD
|
||||
assert payload.member is not None
|
||||
|
||||
try:
|
||||
# Finally, add the role.
|
||||
await payload.member.add_roles(role)
|
||||
|
Reference in New Issue
Block a user