Changed ApplicationButtonsView
to disable buttons only when acc/dec modal is Submittedmain
parent
88dc6f6294
commit
a7d187a645
12
bot.py
12
bot.py
|
@ -92,8 +92,6 @@ class ApplicationButtonsView(discord.ui.View):
|
||||||
custom_id=f"persistent:accept",
|
custom_id=f"persistent:accept",
|
||||||
)
|
)
|
||||||
async def accept(self, button: discord.ui.Button, interaction: discord.Interaction):
|
async def accept(self, button: discord.ui.Button, interaction: discord.Interaction):
|
||||||
self.disable_all_items()
|
|
||||||
print(interaction.message.id)
|
|
||||||
msg_id = str(interaction.message.id)
|
msg_id = str(interaction.message.id)
|
||||||
con = sqlite3.connect("applications.db")
|
con = sqlite3.connect("applications.db")
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
|
@ -104,7 +102,6 @@ class ApplicationButtonsView(discord.ui.View):
|
||||||
modal.set_action("acc")
|
modal.set_action("acc")
|
||||||
modal.add_item(discord.ui.InputText(label=f"Reason: "))
|
modal.add_item(discord.ui.InputText(label=f"Reason: "))
|
||||||
await interaction.response.send_modal(modal)
|
await interaction.response.send_modal(modal)
|
||||||
await interaction.followup.edit_message(message_id = interaction.message.id, view=self)
|
|
||||||
|
|
||||||
@discord.ui.button(
|
@discord.ui.button(
|
||||||
label="Decline",
|
label="Decline",
|
||||||
|
@ -112,8 +109,6 @@ class ApplicationButtonsView(discord.ui.View):
|
||||||
custom_id=f"persistent:decline",
|
custom_id=f"persistent:decline",
|
||||||
)
|
)
|
||||||
async def decline(self, button: discord.ui.Button, interaction: discord.Interaction):
|
async def decline(self, button: discord.ui.Button, interaction: discord.Interaction):
|
||||||
self.disable_all_items()
|
|
||||||
print(interaction.message.id)
|
|
||||||
msg_id = str(interaction.message.id)
|
msg_id = str(interaction.message.id)
|
||||||
con = sqlite3.connect("applications.db")
|
con = sqlite3.connect("applications.db")
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
|
@ -124,7 +119,6 @@ class ApplicationButtonsView(discord.ui.View):
|
||||||
modal.set_action("dec")
|
modal.set_action("dec")
|
||||||
modal.add_item(discord.ui.InputText(label=f"Reason: "))
|
modal.add_item(discord.ui.InputText(label=f"Reason: "))
|
||||||
await interaction.response.send_modal(modal)
|
await interaction.response.send_modal(modal)
|
||||||
await interaction.followup.edit_message(message_id = interaction.message.id, view=self)
|
|
||||||
|
|
||||||
class ApplicationModal(discord.ui.Modal):
|
class ApplicationModal(discord.ui.Modal):
|
||||||
def set_action(self, action):
|
def set_action(self, action):
|
||||||
|
@ -150,6 +144,9 @@ class ApplicationModal(discord.ui.Modal):
|
||||||
embed.add_field(name=f'Reason:', value=reason, inline=False)
|
embed.add_field(name=f'Reason:', value=reason, inline=False)
|
||||||
embed.colour = discord.Colour.green()
|
embed.colour = discord.Colour.green()
|
||||||
await interaction.followup.edit_message(message_id = interaction.message.id, embeds=[emb, embed])
|
await interaction.followup.edit_message(message_id = interaction.message.id, embeds=[emb, embed])
|
||||||
|
view = discord.ui.View.from_message(interaction.message)
|
||||||
|
view.disable_all_items()
|
||||||
|
await interaction.followup.edit_message(message_id = interaction.message.id, view = view)
|
||||||
if self.action == "dec":
|
if self.action == "dec":
|
||||||
user = await bot.get_user(user_id).create_dm()
|
user = await bot.get_user(user_id).create_dm()
|
||||||
await user.send(f"You have been declined access to the CreatTopia Minecraft server.")
|
await user.send(f"You have been declined access to the CreatTopia Minecraft server.")
|
||||||
|
@ -161,6 +158,9 @@ class ApplicationModal(discord.ui.Modal):
|
||||||
embed.add_field(name=f'Reason:', value=reason, inline=False)
|
embed.add_field(name=f'Reason:', value=reason, inline=False)
|
||||||
embed.colour = discord.Colour.red()
|
embed.colour = discord.Colour.red()
|
||||||
await interaction.followup.edit_message(message_id = interaction.message.id, embeds=[emb, embed])
|
await interaction.followup.edit_message(message_id = interaction.message.id, embeds=[emb, embed])
|
||||||
|
view = discord.ui.View.from_message(interaction.message)
|
||||||
|
view.disable_all_items()
|
||||||
|
await interaction.followup.edit_message(message_id = interaction.message.id, view = view)
|
||||||
|
|
||||||
|
|
||||||
@bot.slash_command(description = "Command used to set up the application prompt")
|
@bot.slash_command(description = "Command used to set up the application prompt")
|
||||||
|
|
Loading…
Reference in New Issue