Elezthem
@Elezthem
Full Stack Developer

Бот вообще не видит команды, что делать?

Бот в сети, но команды вообще не видит

import nextcord
from nextcord.ext import commands
from nextcord.shard import EventItem
import wavelinkcord as wavelink

bot_version = "0.0.1"

intents = nextcord.Intents.all()
client = nextcord.Client()
bot = commands.Bot(command_prefix="?", intents=intents)

bot.event
async def on_ready():
    print("Bot Ready!")
    bot.loop.create_task(on_node())

async def on_node():

    node: wavelink.Node = wavelink.Node(uri="http://lavalink.clxud.pro:2333", password="пароль не скажу)")
    await wavelink.NodePool.connect(client=bot, nodes=[node])
    wavelink.Player.autoplay = True

bot.slash_command(guild_ids=[1047965489701343262])
async def play(interaction : nextcord.Integration, search : str):

    query = await wavelink.YouTubeTrack.search(search, return_first=True)
    destination = interaction.user.voice.channel

    if not interaction.guild.voice_client:

        vc: wavelink.Player = await destination.connect(cls=wavelink.Player)
    else:
        vc: wavelink.Player = interaction.guild.voice_client

    if vc.queue.is_empty and not vc.is_playing():

        await vc.play(query)
        await interaction.response.send_message(f"Now Playing {vc.current.title}")
    else:
        await vc.queue.put_wait(query)
        await interaction.response.send_message(f"Song was added to the queue")

@bot.slash_command(guild_ids=[1047965489701343262])
async def skip(interaction : nextcord.Integration):
    vc: wavelink.Player = interaction.guild.voice_client
    await vc.stop()
    await interaction.response.send_message(f"Song was skipped!")

@bot.slash_command(guild_ids=[1047965489701343262])
async def pause(interaction : nextcord.Integration):

    vc: wavelink.Player = interaction.guild.voice_client

    if vc.is_playing():

        await vc.pause()
        await interaction.response.send_message(f"Song was paused")
    else:
        await interaction.response.send_message(f"Song is already paused!")

@bot.slash_command(guild_ids=[1047965489701343262])
async def resume(interaction : nextcord.Integration):

    vc: wavelink.Player = interaction.guild.voice_client

    if vc.is_playing():

        await interaction.response.send_message(f"Song is already resumed!")
    else:
        await interaction.response.send_message(f"Song is resumed!")
        await vc.resume

@bot.slash_command(guild_ids=[1047965489701343262])
async def disconnect(interaction : nextcord.Integration):

    vc: wavelink.Player = interaction.guild.voice_client
    await vc.disconnect()
    await interaction.response.send_message(f"The bot was disconnected!")

@bot.slash_command(guild_ids=[1047965489701343262])
async def queue(interaction : nextcord.Integration):

    vc: wavelink.Player = interaction.guild.voice_client

    if not vc.queue.is_empty:

        song_counter = 0
        songs = []
        queue = vc.queue.copy()
        embed = nextcord.Embed(title="Queue")

        for song in queue:

            song_counter += 1
            songs.append(song)
            embed.add_field(name=f"[{song_counter}] Duration {song.duration}", value=f"{song.title}", inline=False)
        
        await interaction.response.send_message(embed=embed)
    else:
        await interaction.response.send_message("The queue is empty!")


Вот и сама ошибка
Ignoring exception in on_connect
Traceback (most recent call last):
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 490, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 2458, in on_connect
    self.add_all_application_commands()
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 2473, in add_all_application_commands
    self._add_decorated_application_commands()
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 2537, in _add_decorated_application_commands
    command.from_callback(command.callback)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 2795, in from_callback
    BaseApplicationCommand.from_callback(self, callback=callback, option_class=option_class)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 2385, in from_callback
    super().from_callback(callback=callback, option_class=option_class)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 790, in from_callback
    raise e
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 772, in from_callback
    raise ValueError(
ValueError: Callback SlashApplicationCommand queue <function queue at 0x000001F5A4C1B1C0> is missing the interaction 
parameter. Please double check your function definition.
  • Вопрос задан
  • 234 просмотра
Решения вопроса 1
@resweirdoo
В строке
bot.slash_command(guild_ids=[1047965489701343262])
ошибка, вы не сделали эту функцию декоратором
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
04 мая 2024, в 23:17
1200 руб./в час
04 мая 2024, в 22:32
2000 руб./за проект
04 мая 2024, в 22:10
2001 руб./за проект