mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-16 18:50:13 +00:00
Update proxy.py
Adding code to remove question mark reaction after sending the message card
This commit is contained in:
parent
3d913018d0
commit
10113d331e
1 changed files with 8 additions and 5 deletions
|
|
@ -233,15 +233,15 @@ async def try_delete_by_reaction(conn, client: discord.Client, message_id: int,
|
|||
|
||||
await handle_deleted_message(conn, client, message_id, original_message.content, logger)
|
||||
|
||||
async def do_query_message(conn, client: discord.Client, queryer_id: int, message_id: int) -> bool:
|
||||
async def do_query_message(conn, client: discord.Client, payload: RawReactionActionEvent) -> bool:
|
||||
# Find the message that was queried
|
||||
msg = await db.get_message(conn, message_id)
|
||||
msg = await db.get_message(conn, payload.message_id)
|
||||
if not msg:
|
||||
return False
|
||||
|
||||
# Then DM the queryer the message embed
|
||||
card = await embeds.message_card(client, msg, include_pronouns=True)
|
||||
user = client.get_user(queryer_id)
|
||||
card = await embeds.message_card(client, msg)
|
||||
user = client.get_user(payload.user_id)
|
||||
if not user:
|
||||
# We couldn't find this user in the cache - bail
|
||||
return False
|
||||
|
|
@ -249,6 +249,9 @@ async def do_query_message(conn, client: discord.Client, queryer_id: int, messag
|
|||
# Send the card to the user
|
||||
try:
|
||||
await user.send(embed=card)
|
||||
message = await client.fetch_message(payload.message_id)
|
||||
if message.guild and message.channel.permissions_for(message.guild.get_member(client.user.id)).manage_messages:
|
||||
await message.remove_reaction(payload.emoji, user)
|
||||
except discord.Forbidden:
|
||||
# User doesn't have DMs enabled, not much we can do about that
|
||||
pass
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue