#modal not working

1 messages · Page 1 of 1 (latest)

half sail
#

yes

#
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

lone kindle
#

just don't defer

half sail
#

lemme try again

lone kindle
#

though i think this might have been related to a bug on b5

#

(regardless there's no point in you deferring here)

half sail
#

3s exceeded

lone kindle
#

? how are you exceeding 3s there

#

or is this just a template

half sail
#

bot shows, didnt respond

#

The application did not respond

lone kindle
#

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

half sail
#

thats why i sent whole code

#

no error is being logged

#

whats happening then?

lone kindle
#

oh ctx.send_modal doesn't exist

#

huh

half sail
#

uhmm, its written in examples of pycord github page

#

copied from there

lone kindle
#

yeah ignore me, wrong test

half sail
#

should i try upgrade to b7?

lone kindle
#

i guess

half sail
#

@lone kindle still

lone kindle
#

can you show the full code

half sail
#
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)