#modal not working
1 messages · Page 1 of 1 (latest)
class MyModal(Modal):
def __init__(self, title: str):
super().__init__(title)
self.add_item(InputText(label="What do you like the most in this bot?", placeholder="Describe briefly"))
self.add_item(InputText(label='I am adding Auctions to my bot. Please suggest what need to be added in it.',
value="Please describe what dream features you want in this auctions part",
style=discord.InputTextStyle.long))
async def callback(self, interaction: discord.Interaction):
embed = discord.Embed(title="Your Modal Results", color=discord.Color.random())
embed.add_field(name="First Input", value=self.children[0].value, inline=False)
embed.add_field(name="Second Input", value=self.children[1].value, inline=False)
await interaction.response.send_message(embed=embed)
class Feedback(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="modaltest", guild_ids=[934026380092530708])
async def modal_slash(self, ctx):
await ctx.defer()
modal = MyModal(title="Myuu Utils Feedback Form")
await ctx.send_modal(modal)
its not working after defer()
pycord version b5
just don't defer
lemme try again
though i think this might have been related to a bug on b5
(regardless there's no point in you deferring here)
3s exceeded
there is zero reason for py @commands.slash_command(name="modaltest", guild_ids=[934026380092530708]) async def modal_slash(self, ctx): modal = MyModal(title="Myuu Utils Feedback Form") await ctx.send_modal(modal) to take 3 seconds
yeah ignore me, wrong test
should i try upgrade to b7?
i guess
@lone kindle still
can you show the full code
from discord.ext import commands
from discord import Embed, Option
import discord
import sys
import os
from discord.ui import InputText, Modal
from main import datadb, configdb, raffle_configdb
datadb = datadb
configdb = configdb
raffle_configdb = raffle_configdb
def setup(bot):
bot.add_cog(Feedback(bot))
class MyModal(Modal):
def __init__(self, title: str):
super().__init__(title)
self.add_item(InputText(label="What do you like the most in this bot?", placeholder="Describe briefly"))
self.add_item(InputText(label='I am adding Auctions to my bot. Please suggest what need to be added in it.',
value="Please describe what dream features you want in this auctions part",
style=discord.InputTextStyle.long))
async def callback(self, interaction: discord.Interaction):
embed = discord.Embed(title="Your Modal Results", color=discord.Color.random())
embed.add_field(name="First Input", value=self.children[0].value, inline=False)
embed.add_field(name="Second Input", value=self.children[1].value, inline=False)
await interaction.response.send_message(embed=embed)
class Feedback(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="modaltest", guild_ids=[934026380092530708])
async def modal_slash(self, ctx):
modal = MyModal(title="Myuu Utils Feedback Form")
await ctx.send_modal(modal)