|
|
@@ -199,13 +199,15 @@ async def ban(
|
|
|
#---------------------------------------------------------------------------------------#
|
|
|
#TESTs of Modals and Views
|
|
|
|
|
|
-
|
|
|
class MyModal(discord.ui.Modal):
|
|
|
def __init__(self, *args, **kwargs) -> None:
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
- self.add_item(discord.ui.InputText(label="Short Input"))
|
|
|
- self.add_item(discord.ui.InputText(label="Long Input", style=discord.InputTextStyle.long))
|
|
|
+ self.add_item(discord.ui.InputText(label="Teilnehmende Spieler", placeholder="Gib die Namen der teilnehmenden Spieler ein, wenn du alleie bist: Strich."))
|
|
|
+ self.add_item(discord.ui.InputText(label="Benötigte Ausrüstung", placeholder="Gib die benötigte Ausrüstung an (Drogen, Waffen, etc.)."))
|
|
|
+ self.add_item(discord.ui.InputText(label="Situationsbeschreibung", style=discord.InputTextStyle.long, placeholder="Beschreibe die Situation so detailliert wie möglich (Was? Wo? Wie?)."))
|
|
|
+ self.add_item(discord.ui.InputText(label="Besonderheiten", placeholder="Langzeitsituationen, besondere Umstände, etc."))
|
|
|
+
|
|
|
|
|
|
async def callback(self, interaction: discord.Interaction):
|
|
|
embed = discord.Embed(title="Modal Results")
|
|
|
@@ -213,15 +215,12 @@ class MyModal(discord.ui.Modal):
|
|
|
embed.add_field(name="Long Input", value=self.children[1].value)
|
|
|
await interaction.response.send_message(embeds=[embed])
|
|
|
|
|
|
-class MyView(discord.ui.View):
|
|
|
- @discord.ui.button(label="Send Modal")
|
|
|
- async def button_callback(self, button, interaction):
|
|
|
- await interaction.response.send_modal(MyModal(title="Modal via Button"))
|
|
|
|
|
|
@bot.slash_command()
|
|
|
-async def send_modal(ctx):
|
|
|
- await ctx.respond(view=MyView())
|
|
|
-
|
|
|
+async def civsitu(ctx: discord.ApplicationContext):
|
|
|
+ """Shows an example of a modal dialog being invoked from a slash command."""
|
|
|
+ modal = MyModal(title="Modal via Slash Command")
|
|
|
+ await ctx.send_modal(modal)
|
|
|
|
|
|
|
|
|
bot.run(token)
|