Моя команда «synx», которая использовалась для синхронизации команд, сломалась и не запускается в DiscordPython

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Моя команда «synx», которая использовалась для синхронизации команд, сломалась и не запускается в Discord

Сообщение Anonymous »

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

import discord
from discord import app_commands
from discord.ext import commands
bot = commands.Bot(command_prefix="!", intents = discord.Intents.all())
e = 'smth went wrong while syncing'
@bot.event
async def on_ready():
try:                # syncing the command
synced = await bot.tree.sync()
print(f'{len(synced)} commands has been synced succsesfully')
except Exception as e:
print (e)

@bot.tree.command(name='hmmm')
async def hello (interaction: discord.Interaction):
await interaction.response.send_message(f'Slash commands are ready, {interaction.user.mention}',
ephemeral=True) # makes command visible only to you

@bot.tree.command(name='synx', description='expiremental sync')
@app_commands.checks.has_any_role(1024396774955298909, 1249016717032820770, 1309514819245834360)
async def sync(interaction: discord.Interaction):
await bot.tree.sync()
print('Command tree synced expirementaly')
await interaction.response.send_message(f'Command tree synced expirementaly, {interaction.user.mention}', ephemeral=True)

все работало нормально, потом я кое-что изменил, и оно перестало работать, и я не могу понять, в чем дело.
Вывод на консоль:

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

> 2 commands has been synced succsesfully
Command tree synced expirementaly
2024-11-22 22:22:52 ERROR    discord.app_commands.tree Ignoring exception in command 'synx'
Traceback (most recent call last):
File "C:\Users\lazorzneq\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\commands.py", line 858, in _do_call
return await self._callback(interaction, **params)  # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\lazorzneq\Documents\Project.Discord\Swift Blink\Welcome.py", line 38, in sync
await interaction.response.send_message(f'Command tree synced expirementaly, {interaction.user.mention}', ephemeral=True)
File "C:\Users\lazorzneq\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\interactions.py", line 855, in send_message
await adapter.create_interaction_response(
File "C:\Users\lazorzneq\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\webhook\async_.py", line 221, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

The above exception was the direct cause of the following exception:

The above exception was the direct cause of the following exception:

The above exception was the direct cause of the following exception:

The above exception was the direct cause of the following exception:

The above exception was the direct cause of the following exception:

The above exception was the direct cause of the following exception:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\lazorzneq\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\tree.py", line 1310, in _call
await command._invoke_with_namespace(interaction, namespace)
File "C:\Users\lazorzneq\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\commands.py", line 883, in _invoke_with_namespace
return await self._do_call(interaction, transformed_values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lazorzneq\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\commands.py", line 876, in _do_call
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'synx' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction
Мне нужна команда дерева, которая синхронизировала бы мои команды. Кроме того, было бы неплохо, если бы я мог преобразовать в гибридную команду

Подробнее здесь: https://stackoverflow.com/questions/792 ... run-in-dis
Реклама
Ответить Пред. темаСлед. тема

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

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

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

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

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

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