Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Dec 4, 2023
1 parent 322d90d commit a3398dc
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timedelta
import json
from nextcord import slash_command
from nextcord.ext.commands import Bot, Cog
Expand Down Expand Up @@ -51,7 +51,6 @@ class QuickResponse(nextcord.ui.Modal):
def __init__(self, person) -> None:
super().__init__(
title="Quick Response",
custom_id="persistant_modal:quickresponse",
timeout=None,
)
self.person = person
Expand All @@ -62,12 +61,13 @@ def __init__(self, person) -> None:
placeholder="Response here...",
required=True,
max_length=1800,
custom_id="persistant_modal:quickresponse_response",
)
self.add_item(self.details)

async def callback(self, inter: nextcord.Interaction) -> None:
if isinstance(inter.channel, nextcord.TextChannel):
marlow = inter.guild.get_member(MARLOW_ID)

category = nextcord.utils.get(inter.guild.categories, id=TICKET_CATEGORY)
new_channel = await category.create_text_channel(
name=f"ticket-{inter.user.name}",
Expand All @@ -78,15 +78,16 @@ async def callback(self, inter: nextcord.Interaction) -> None:
f"Ticket created: <#{new_channel.id}>", ephemeral=True
)
em = nextcord.Embed()
em.color = AD_EMBED_COLOR
em.color = EMBED_COLOR
em.set_author(icon_url=marlow.user.avatar, name=marlow.user.name)
em.add_field(name="**CONTACT REQUEST ACCEPTED**", value="", inline=False)
em.add_field(name="**message**", value=self.details.value, inline=False)
em.set_footer(text=f"{inter.user.id}{get_date()}{get_time()}")

await new_channel.send(
content=f"<@{inter.user.id}>",
embed=em,
view=AdView(),
view=CloseView(),
)


Expand All @@ -103,13 +104,24 @@ async def accept(self, btn: nextcord.ui.Button, inter: nextcord.Interaction):

@nextcord.ui.button(
label="Quick Response",
style=nextcord.ButtonStyle.red,
custom_id="ticket:reject",
style=nextcord.ButtonStyle.blurple,
custom_id="ticket:quickresponse",
)
async def quickresponse(self, btn: nextcord.ui.Button, inter: nextcord.Interaction):
await inter.response.send_modal(QuickResponse(self.person))


class CloseView(nextcord.ui.View):
def __init__(self) -> None:
super().__init__(timeout=None)

@nextcord.ui.button(
label="Close", style=nextcord.ButtonStyle.red, custom_id="ticket:close"
)
async def close(self, btn: nextcord.ui.Button, inter: nextcord.Interaction):
pass


class AdView(nextcord.ui.View):
def __init__(self) -> None:
super().__init__(timeout=None)
Expand Down Expand Up @@ -194,6 +206,9 @@ async def callback(self, inter: nextcord.Interaction) -> None:
em.set_footer(text=f"{inter.user.id}{get_date()}{get_time()}")

await target_channel.send(embed=em, view=RequestView(person=inter))
await inter.response.send_message(
"""📫 **Your request has been sent!**""", ephemeral=True
)


class Inquiry(Cog):
Expand Down

0 comments on commit a3398dc

Please sign in to comment.