diff --git a/cogs/inquiry.py b/cogs/inquiry.py index 564ec15..c00d5ae 100644 --- a/cogs/inquiry.py +++ b/cogs/inquiry.py @@ -87,6 +87,7 @@ async def callback(self, inter: nextcord.Interaction) -> None: person = await inter.guild.fetch_member(self.person) id = person.id name = person.name + nick = person.nick category = nextcord.utils.get(inter.guild.categories, id=CLOSED_CATEGORY) new_channel = await category.create_text_channel( name=f"ticket-{name}", @@ -99,7 +100,7 @@ async def callback(self, inter: nextcord.Interaction) -> None: # inquiry again emb = nextcord.Embed() emb.color = INQUIRY - emb.set_author(name=f"{name} inquired:", icon_url=person.avatar) + emb.set_author(name=f"{nick} inquired:", icon_url=person.avatar) emb.description = self.message emb.set_footer(text=format_footer(id)) await new_channel.send( @@ -138,21 +139,23 @@ async def accept(self, btn: nextcord.ui.Button, inter: nextcord.Interaction): person = await inter.guild.fetch_member(msg) id = person.id name = person.name - category = nextcord.utils.get(inter.guild.categories, id=AD_CATEGORY) - new_channel = await category.create_text_channel( - name=f"ticket-{name}", - reason=f"Created ticket for {id} - {name}", - topic=id, - ) - await inter.response.send_message( - f"Ticket created: <#{new_channel.id}>", ephemeral=True - ) + nick = person.nick + await inter.message.delete() em = nextcord.Embed() if inter.channel.id == AD_CHANNEL: # IS AD + category = nextcord.utils.get(inter.guild.categories, id=AD_CATEGORY) + new_channel = await category.create_text_channel( + name=f"ticket-{name}", + reason=f"Created ticket for {id} - {name}", + topic=id, + ) + await inter.response.send_message( + f"Ticket created: <#{new_channel.id}>", ephemeral=True + ) em.color = SUCCESS em.set_author( - name=f"{name} requested an advertisement:", icon_url=person.avatar + name=f"{nick} requested an advertisement:", icon_url=person.avatar ) em.description = content em.set_footer(text=format_footer(id)) @@ -173,8 +176,17 @@ async def accept(self, btn: nextcord.ui.Button, inter: nextcord.Interaction): else: # IS NOT AD + category = nextcord.utils.get(inter.guild.categories, id=TICKET_CATEGORY) + new_channel = await category.create_text_channel( + name=f"ticket-{name}", + reason=f"Created ticket for {id} - {name}", + topic=id, + ) + await inter.response.send_message( + f"Ticket created: <#{new_channel.id}>", ephemeral=True + ) em.color = INQUIRY - em.set_author(name=f"{name} inquired:", icon_url=person.avatar) + em.set_author(name=f"{nick} inquired:", icon_url=person.avatar) em.description = content em.set_footer(text=format_footer(id)) diff --git a/cogs/ticket.py b/cogs/ticket.py index 1a5cf5f..2d0fc03 100644 --- a/cogs/ticket.py +++ b/cogs/ticket.py @@ -8,7 +8,7 @@ class CloseRequest(nextcord.ui.View): - def __init__(self, inter: nextcord.Interaction, old_channel: nextcord.TextChannel): + def __init__(self, inter=None, old_channel=None): super().__init__(timeout=60) self.inter = inter self.old_channel = old_channel @@ -59,6 +59,7 @@ async def on_ready(self) -> None: if not self.persistent_views_added: self.bot.add_view(CloseView()) + self.bot.add_view(CloseRequest()) self.persistent_views_added = True @slash_command(name="close", description="close a ticket")