feat(commands/execute): track sent messages

This commit is contained in:
Ryan 2025-01-05 16:49:33 -05:00
parent 116ed896ab
commit e540b266c7
Signed by: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3
2 changed files with 11 additions and 7 deletions

15
core.py
View File

@ -12,7 +12,7 @@ import commands
import constants import constants
import core import core
import utils import utils
from state import client, command_locks from state import client, command_locks, executed_messages
async def on_message(message): async def on_message(message):
@ -80,20 +80,23 @@ async def on_message(message):
if len(output) > 2000: if len(output) > 2000:
output = output.replace("`", "\\`") output = output.replace("`", "\\`")
pager = disnake_paginator.ButtonPaginator( await disnake_paginator.ButtonPaginator(
prefix=f"```\n", prefix=f"```\n",
suffix="```", suffix="```",
invalid_user_function=utils.invalid_user_handler,
color=constants.EMBED_COLOR, color=constants.EMBED_COLOR,
segments=disnake_paginator.split(output), segments=disnake_paginator.split(output),
invalid_user_function=utils.invalid_user_handler, ).start(
)
await pager.start(
disnake_paginator.wrappers.MessageInteractionWrapper(message) disnake_paginator.wrappers.MessageInteractionWrapper(message)
) )
elif len(output.strip()) == 0: elif len(output.strip()) == 0:
await utils.add_check_reaction(message) await utils.add_check_reaction(message)
else: else:
await message.channel.send(output) if message.id in executed_messages:
await executed_messages[message.id].edit(output)
else:
response = await message.channel.send(output)
executed_messages[message.id] = response
case C.CLEAR | C.PURGE if message.author.id in constants.OWNERS: case C.CLEAR | C.PURGE if message.author.id in constants.OWNERS:
await commands.tools.clear(message) await commands.tools.clear(message)
case C.JOIN: case C.JOIN:

View File

@ -2,8 +2,9 @@ import time
import disnake import disnake
players = {}
command_locks = {} command_locks = {}
executed_messages = {}
players = {}
intents = disnake.Intents.default() intents = disnake.Intents.default()
intents.message_content = True intents.message_content = True