Я хотел попробовать добавить / команды к своему боту, но по какой-то причине в 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
Discord.py не отвечает ⇐ Python
Программы на Python
1732571067
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)
Подробнее здесь: [url]https://stackoverflow.com/questions/79211234/discord-py-not-responding[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия