From 2f3cf9f81b280eff9f2f4566b364ad3e9ca5bf59 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 30 Dec 2024 14:56:12 -0500 Subject: [PATCH] refactor: add helper for checkmark reaction --- commands/voice.py | 2 +- events.py | 2 +- main.py | 3 ++- utils.py | 4 ++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/commands/voice.py b/commands/voice.py index d1ff308..45fa3b0 100644 --- a/commands/voice.py +++ b/commands/voice.py @@ -29,7 +29,7 @@ async def queue_or_play(message): if args.clear: player_queue[message.guild.id] = [] - await message.add_reaction("✅") + await utils.add_check_reaction(message) return elif query := args.query: try: diff --git a/events.py b/events.py index e16ba7c..a8d8155 100644 --- a/events.py +++ b/events.py @@ -70,7 +70,7 @@ async def on_message(message): disnake_paginator.wrappers.MessageInteractionWrapper(message) ) elif len(output.strip()) == 0: - await message.add_reaction("✅") + await utils.add_check_reaction(message) else: await message.channel.send(output) case C.CLEAR | C.PURGE: diff --git a/main.py b/main.py index 57f04a1..3981d17 100644 --- a/main.py +++ b/main.py @@ -7,6 +7,7 @@ import commands import constants import core import events +import utils from state import client, start_time @@ -42,7 +43,7 @@ async def on_message(message): ): rreload(reloaded_modules, module) - await message.add_reaction("✅") + await utils.add_check_reaction(message) return await events.on_message(message) diff --git a/utils.py b/utils.py index cd6a78a..9434a78 100644 --- a/utils.py +++ b/utils.py @@ -3,6 +3,10 @@ import disnake import constants +async def add_check_reaction(message): + await message.add_reaction("✅") + + async def reply(message, *args): await message.reply(*args, allowed_mentions=disnake.AllowedMentions.none())