Skip to content

Commit

Permalink
adding persistant modals
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Nov 27, 2023
1 parent f5236a7 commit 59cf098
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
class AdForm(nextcord.ui.Modal):
def __init__(self) -> None:
super().__init__(
"Advertisement Services",
timeout=5 * 60, # 5 minutes
title="Advertisement Services",
custom_id="persistant_modal:adform",
timeout=None,
)

self.details = nextcord.ui.TextInput(
Expand All @@ -31,6 +32,7 @@ def __init__(self) -> None:
placeholder="Contact Reason",
required=True,
max_length=1800,
custom_id="persistant_modal:adform_details",
)
self.add_item(self.details)

Expand Down Expand Up @@ -74,8 +76,7 @@ async def mark_paid(interaction):
class QuestionForm(nextcord.ui.Modal):
def __init__(self):
super().__init__(
"Contact Marlow",
timeout=5 * 60, # 5 minutes
title="Contact Marlow", custom_id="persistant_modal:question", timeout=None
)

self.details = nextcord.ui.TextInput(
Expand All @@ -84,6 +85,7 @@ def __init__(self):
placeholder="Contact Reason",
required=True,
max_length=1800,
custom_id="persistent_modal:details",
)
self.add_item(self.details)

Expand Down Expand Up @@ -120,6 +122,12 @@ async def ad_btn_callback(interaction):
class Inquiry(Cog):
def __init__(self, bot: Bot) -> None:
self.bot = bot
self.persistent_modal_added = False

async def add_persistent_modal(self):
if not self.persistent_modal_added:
self.bot.add_view(AdForm())
self.persistent_modal_added = True

@slash_command(name="deploy", description="Send inquiry embed")
async def deploy(self, ctx) -> None:
Expand Down

0 comments on commit 59cf098

Please sign in to comment.