Add type hints to message handling functions for improved clarity
This commit is contained in:
parent
be1cc61443
commit
ef84fccac5
1 changed files with 6 additions and 4 deletions
|
@ -81,12 +81,12 @@ async def ai_reply(message):
|
|||
await message.reply(answer)
|
||||
|
||||
|
||||
async def react(message):
|
||||
async def react(message: discord.Message) -> None:
|
||||
await message.add_reaction(random.choice(message.guild.emojis))
|
||||
|
||||
|
||||
@bot.listen("on_message")
|
||||
async def on_message(message):
|
||||
async def on_message(message: discord.Message) -> None:
|
||||
if message.flags.ephemeral:
|
||||
return
|
||||
|
||||
|
@ -105,7 +105,9 @@ async def on_message(message):
|
|||
|
||||
|
||||
@bot.listen("on_reaction_add")
|
||||
async def add_more_reaction(reaction, user):
|
||||
async def add_more_reaction(
|
||||
reaction: discord.Reaction, user: discord.Member | discord.User
|
||||
) -> None:
|
||||
if random.random() < 50 / 100:
|
||||
logger.info(f"Copy reaction from {user}")
|
||||
await reaction.message.add_reaction(reaction.emoji)
|
||||
|
@ -123,7 +125,7 @@ async def react_message_edit(before: discord.Message, after: discord.Message) ->
|
|||
|
||||
|
||||
@bot.listen("on_message")
|
||||
async def rando_shuffle(message):
|
||||
async def rando_shuffle(message: discord.Message) -> None:
|
||||
if not message.flags.ephemeral and random.random() < 5 / 100 and message.guild:
|
||||
logger.info(f"Message shuffle after message from {message.author}")
|
||||
await try_shuffle(message.guild)
|
||||
|
|
Loading…
Add table
Reference in a new issue