Improve message handling in send function

Enhances the send function to handle different Discord message response types more robustly by normalizing the returned message object. This ensures compatibility with InteractionCallbackResponse, WebhookMessage, and InteractionMessage types.
This commit is contained in:
Choco
2025-08-24 21:31:03 +08:00
parent 24cd6caefa
commit 0e8b3ce9e7

View File

@@ -238,7 +238,15 @@ async def send(
send_kwargs["view"] = view
# Send the message or embed
return await send_func(**send_kwargs)
message = await send_func(**send_kwargs)
if isinstance(message, discord.InteractionCallbackResponse):
message = message.resource
if isinstance(message, (discord.WebhookMessage, discord.InteractionMessage)):
message = await message.fetch()
return message
async def update_db(db: AsyncIOMotorCollection, tempStore: dict, filter: dict, data: dict) -> bool:
for mode, action in data.items():