Skip to content

Commit

Permalink
bunimokpl[;]'
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Dec 10, 2023
1 parent 2b2ab60 commit 2c27642
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,28 @@ async def callback(self, inter: nextcord.Interaction) -> None:
)


def create_button(button_id):
@nextcord.ui.button(
label="Quick Response",
style=nextcord.ButtonStyle.blurple,
custom_id=f"ticket:{button_id}",
)
async def quickresponse(self, btn: nextcord.ui.Button, inter: nextcord.Interaction):
p = str(btn.custom_id).split(":")
await inter.response.send_modal(QuickResponse(person=p[1]))

return quickresponse


class RequestView(nextcord.ui.View):
def __init__(self, person=None, message=None) -> None:
def __init__(self, person: int, message) -> None:
super().__init__(timeout=None)
self.person = person
self.message = message
try:
on_button_click = create_button(person)
self.add_item(on_button_click)
except TypeError:
pass

@nextcord.ui.button(
label="Accept", style=nextcord.ButtonStyle.green, custom_id="requestview:accept"
Expand Down Expand Up @@ -198,15 +215,6 @@ async def accept(self, btn: nextcord.ui.Button, inter: nextcord.Interaction):
view=CloseView(),
)

@nextcord.ui.button(
label="Quick Response",
style=nextcord.ButtonStyle.blurple,
custom_id="ticket:ID", ### SUB ID??
)
async def quickresponse(self, btn: nextcord.ui.Button, inter: nextcord.Interaction):
p = str(btn.custom_id).split(":")
await inter.response.send_modal(QuickResponse(person=p[1]))


class AdView(nextcord.ui.View):
def __init__(self) -> None:
Expand Down Expand Up @@ -345,7 +353,7 @@ async def on_ready(self) -> None:
self.persistent_modals_added = True

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

0 comments on commit 2c27642

Please sign in to comment.