#error : This interaction failed

1 messages · Page 1 of 1 (latest)

crisp oak
#

import discord, asyncio
import os
from discord.ext import commands
from discord import app_commands, Intents, File, ButtonStyle, ui
from discord.ui import Button, Select, View
from tinydb import TinyDB, Query
import time
from PIL import Image, ImageDraw, ImageFilter
from keep_alive import keep_alive
keep_alive()

token = os.environ['token']

intents = Intents.default()
intents.members = True
intents.message_content = True
intents.typing = False
intents.presences = False

bot = commands.Bot(command_prefix='$', intents=intents)

@bot.event
async def on_ready():
print(f'Logged in as {bot.user.name} ({bot.user.id})')

@bot.command()
async def معلومات(ctx):
buttons = [
Button(label='تست', custom_id='we', style=discord.ButtonStyle.primary),
Button(label='تسست', custom_id='you', style=discord.ButtonStyle.primary),
Button(label='انا', custom_id='me',
style=discord.ButtonStyle.primary)
]
view = View()
view.add_item(buttons[0])
view.add_item(buttons[1])
view.add_item(buttons[2])

await ctx.send('بوت المعلومات:', view=view)

@bot.event
async def on_button_click(interaction):
if interaction.custom_id == 'we':
embed = discord.Embed(title='نحن', description='ولاشي')
await interaction.send(embed=embed)
elif interaction.custom_id == 'you':
embed = discord.Embed(title='انت', description='ويو')
await interaction.send(embed=embed)
elif interaction.custom_id == 'me':
embed = discord.Embed(title='انا', description='قيو')
await interaction.send(embed=embed)

bot.run(token)

glad temple
#

replace await interaction.send(embed=embed) with await interaction.response.send_message(embed=embed)