pythondiscord.pypycord

discord.Interactions don't work only in my bot [solved]


I was trying to create a button for my discord bot and I had an "interaction error". after I searched the entire Internet in search of a solution, I noticed that my bot basically does not work discord.Interactions what should I do? could this be related to the transition from discord.py on pycord?

for example, my button code:

import discord
from discord.ext import commands
from discord.ui import View, Button
intents = discord.Intents.all()
intents.message_content = True

bot = commands.Bot(command_prefix='k.', intents=intents)
@bot.command()
async def button(ctx):
    button = Button(label='button', style=discord.ButtonStyle.blurple, emoji='🐈')
    async def but_callback(interaction):
        await interaction.response.send_message("HI!")
    button.callback = but_callback
    view = View()
    view.add_item(button)
    await ctx.send('click me!', view=view)

bot.run(token)

Solution

  • the problem turned out to be very trivial. after receiving the developer's badge, I did not delete the link to the special site. after the removal, everything worked =|