Skip to content

Commit

Permalink
em -> id func
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Dec 17, 2023
1 parent 67854aa commit 314463f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand Down
6 changes: 6 additions & 0 deletions cogs/utils/formatting.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import nextcord
from datetime import datetime


Expand All @@ -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]

0 comments on commit 314463f

Please sign in to comment.