Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Dec 10, 2023
1 parent 66594f6 commit f242c57
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ async def close(self, btn: nextcord.ui.Button, inter: nextcord.Interaction):


class QuickResponse(nextcord.ui.Modal):
def __init__(self, person) -> None:
def __init__(self, person=None):
super().__init__(
title="Quick Response",
custom_id="ticket:quickresponse",
timeout=None,
)
self.person = person
Expand All @@ -99,6 +100,7 @@ def __init__(self, person) -> None:
placeholder="Response here...",
required=True,
max_length=1800,
custom_id="ticket:quickresponse_details",
)
self.add_item(self.details)

Expand Down Expand Up @@ -133,7 +135,7 @@ async def callback(self, inter: nextcord.Interaction) -> None:


class RequestView(nextcord.ui.View):
def __init__(self, person, message) -> None:
def __init__(self, person=None, message=None):
super().__init__(timeout=None)
self.person = person
self.message = message
Expand All @@ -155,10 +157,13 @@ async def accept(self, btn: nextcord.ui.Button, inter: nextcord.Interaction):
em.color = EMBED_COLOR
em.add_field(name="**CONTACT REQUEST ACCEPTED**", value="", inline=False)
em.add_field(name="**message**", value=self.message, inline=False)
em.set_footer(text=f"{inter.user.id}{get_date()}{get_time()}")
em.set_footer(text=f"{self.person.user.id}{get_date()}{get_time()}")

await new_channel.set_permissions(
self.person.user, send_messages=True, read_messages=True
)
await new_channel.send(
content=f"<@{inter.user.id}>",
content=f"<@{self.person.user.id}>",
embed=em,
view=CloseView(),
)
Expand All @@ -169,7 +174,8 @@ 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):
await inter.response.send_modal(QuickResponse(self.person))
modal = QuickResponse(self.person)
await inter.response.send_modal(modal)


class AdView(nextcord.ui.View):
Expand Down Expand Up @@ -225,7 +231,9 @@ async def callback(self, inter: nextcord.Interaction) -> None:
em.add_field(name="**CONTACT REQUEST ACCEPTED**", value="", inline=False)
em.add_field(name="**reason**", value=self.details.value, inline=False)
em.set_footer(text=f"{inter.user.id}{get_date()}{get_time()}")

await new_channel.set_permissions(
inter.user, send_messages=True, read_messages=True
)
await new_channel.send(
content=f"<@{inter.user.id}> <@{MARLOW_ID}> <@{ADVERTISING_ROLE}>",
embed=em,
Expand Down Expand Up @@ -285,7 +293,7 @@ async def on_ready(self) -> None:
self.persistent_modals_added = True

if not self.persistent_views_added:
self.bot.add_view(RequestView(None, None))
self.bot.add_view(RequestView())
self.bot.add_view(TicketView())
self.bot.add_view(AdView())
self.bot.add_view(CloseView())
Expand Down

0 comments on commit f242c57

Please sign in to comment.