Как убрать ошибку взаимодействия на pycord?Python

Программы на Python
Anonymous
Как убрать ошибку взаимодействия на pycord?

Сообщение Anonymous »

Как исправить ошибку взаимодействия? Я спрашивал ChatGPT, но он водил меня по кругу.
Мой код:

Код: Выделить всё

import discord
import os
from discord.ext import commands
from dotenv import load_dotenv

load_dotenv()
intents = discord.Intents.all()
bot = commands.Bot(command_prefix="t.", intents=intents)

servers = \[1249591729171071077\]

@bot.event
async def on_ready():
print(f"{bot.user} is ready and online!")

@bot.slash_command(description="Приветствие от бота")
async def hello(ctx):
await ctx.send("Привет! Я бот Discord!")

@bot.slash_command(guild_ids=servers, name="ping", description="Отправляет задержку бота.")
async def ping(ctx):
await ctx.send(f"Pong! Задержка составляет {bot.latency} мс.")

bot.run(os.getenv('TOKEN'))
изменение с ctx.send на ctx.respond()

Подробнее здесь: https://stackoverflow.com/questions/786 ... -on-pycord

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