Discord.py не отвечаетPython

Программы на Python
Ответить
Anonymous
 Discord.py не отвечает

Сообщение Anonymous »

Я хотел попробовать добавить / команды к своему боту, но по какой-то причине в Discord мне всегда выдается сообщение об ошибке «Не удалось отреагировать вовремя», почему это происходит
import discord
import os
from discord.ext import commands
from discord import app_commands, Interaction

BOT_TOKEN = 'mycode'

# Create bot instance with intents
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='.', intents=intents)

# Define slash command arguments
@bot.tree.command(name='test', description='Gibt es monkeys')
async def test(interaction: Interaction):
response = f"Received: Hallo"
await interaction.response.send_message(response)

@bot.event
async def on_ready():
try:
print(f'Signed in as {bot.user}')
await bot.tree.sync() # Sync slash commands
print(f"Successfully synced commands.")
except Exception as e:
print(f"Error syncing commands: {e}")

@bot.command()
async def Test(ctx):
await ctx.send("test")

# Run the bot
bot.run(BOT_TOKEN)


Подробнее здесь: https://stackoverflow.com/questions/792 ... responding
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»