#Button interaction stop working after I restart bot

1 messages · Page 1 of 1 (latest)

grizzled valley
#

I am sending code below

#
class TicketPanelView(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
    @discord.ui.button(label='Abrir un ticket', style=discord.ButtonStyle.primary, custom_id='open-ticket')
    async def ticket_callback(self, button, interaction):
        await interaction.user.send("Hola")


class Tickets(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.client = MongoClient("HIDDEN", server_api=ServerApi('1'))
        try:
            self.client.admin.command('ping')
        except Exception as e:
            print(e)
            self.bot.unload_extension("plugins.Tickets")
            return
        self.db = self.client.sramorfo
        self.col = self.db.tickets


    @commands.slash_command(name='load_tickets', test_guilds=[1190605888919195728])
    async def initializedb(self, ctx: discord.ApplicationContext):
        await ctx.respond("Soon")
    @commands.slash_command(name='send_ticket_panel')
    async def send_ticket_panel(self, ctx: discord.ApplicationContext):
        embed = discord.Embed(title="Abrir Ticket", description="Click en el botón verde para abrir ticket")
        await ctx.send(embed=embed, view=TicketPanelView())
        await ctx.respond("Done!", ephemeral=True)


def setup(bot):
    bot.add_cog(Tickets(bot))
#

The thing is that I send a message with the View, but when I restart the bot that view stop working

grizzled valley
#

I placed the super() and the custom_id

#

nothing

#

ah on_ready