diff --git a/cogs/inquiry.py b/cogs/inquiry.py index ba8c1c3..a2017e2 100644 --- a/cogs/inquiry.py +++ b/cogs/inquiry.py @@ -5,7 +5,7 @@ import nextcord from os import getenv from .utils.colors import EMBED_COLOR, SUCCESS, INQUIRY, REPLY, AD_EM_COLOR -from .utils.formatting import format_footer +from .utils.formatting import format_footer, get_id_from_em from views.ad import AdView from views.close import CloseView @@ -130,7 +130,7 @@ def __init__(self): label="Accept", style=nextcord.ButtonStyle.green, custom_id="requestview:accept" ) async def accept(self, btn: nextcord.ui.Button, inter: nextcord.Interaction): - msg = inter.message.embeds[0].footer.text.split("•")[0] + msg = await get_id_from_em(inter) content = inter.message.embeds[0].description person = await inter.guild.fetch_member(msg) id = person.id @@ -189,7 +189,7 @@ async def accept(self, btn: nextcord.ui.Button, inter: nextcord.Interaction): custom_id="ticket:quickresponse", ) async def quickresponse(self, btn: nextcord.ui.Button, inter: nextcord.Interaction): - msg = inter.message.embeds[0].footer.text.split("•")[0] + msg = await get_id_from_em(inter) content = inter.message.embeds[0].description await inter.response.send_modal(QuickResponse(msg, content)) diff --git a/cogs/utils/formatting.py b/cogs/utils/formatting.py index a536f4a..1f85d45 100644 --- a/cogs/utils/formatting.py +++ b/cogs/utils/formatting.py @@ -1,3 +1,4 @@ +import nextcord from datetime import datetime @@ -14,3 +15,8 @@ def get_time() -> str: def format_footer(id: int) -> str: """{ID} • {DATE} • {TIME}""" return f"{id} • {get_date()} • {get_time()}" + + +async def get_id_from_em(inter: nextcord.Interaction) -> str: + """takes in embed and returns the user id in footer""" + return inter.message.embeds[0].footer.text.split("•")[0]