I have a problem. I think this code is well written and the bot turns on and everything, but when I go to execute the commad play I get an error.
@bot.command(name='play', aliases=['sing','p'], description="streams music")
async def play_(ctx, self, *, search: str):
#async def play_(ctx, message, self, *, search: str):
"""Request a song and add it to the queue.
This command attempts to join a valid voice channel if the bot is not already in one.
Uses YTDL to automatically search and retrieve a song.
Parameters
------------
search: str [Required]
The song to search and retrieve using YTDL. This could be a simple search, an ID or URL.
"""
await ctx.trigger_typing()
vc = ctx.voice_client
if not vc:
await ctx.invoke(self.connect_)
player = self.get_player(ctx)
# If download is False, source will be a dict which will be used later to regather the stream.
# If download is True, source will be a discord.FFmpegPCMAudio with a VolumeTransformer.
source = await YTDLSource.create_source(ctx, search, loop=self.bot.loop, download=False)
await player.queue.put(source)
The error is as follows:
discord.ext.commands.errors.MissingRequiredArgument: search is a required argument that is missing.
And I don't know what to do because I have already tried to change the position but an error keeps coming out if someone knows what it is, please tell me