feat(commands/execute): track sent messages
This commit is contained in:
parent
116ed896ab
commit
e540b266c7
15
core.py
15
core.py
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user