Answer the question
In order to leave comments, you need to log in
How to select a track?
Command code:
@commands.command(name='play', aliases=['p','add'])
async def _play(self, ctx: commands.Context, *, search: str = None):
if not search:
return await ctx.reply(f'Использование команды:\n`{determine_prefix(self.bot, ctx.message)}play <Ссылка, или название>`')
if not ctx.voice_state.voice:
await ctx.invoke(self._join)
if get_lang(ctx.message) == "ru":
msg = await ctx.reply(f'Подождите минуту...')
elif get_lang(ctx.message) == "uk":
msg = await ctx.reply(f'Зачекайте хвилину...')
elif get_lang(ctx.message) == "en":
msg = await ctx.reply(f'Wait a minute...')
try:
source1 = await YTDLSource.create_source(ctx, search, loop=self.bot.loop)
source2 = await YTDLSource.create_source(ctx, search, loop=self.bot.loop)
source3 = await YTDLSource.create_source(ctx, search, loop=self.bot.loop)
source4 = await YTDLSource.create_source(ctx, search, loop=self.bot.loop)
source5 = await YTDLSource.create_source(ctx, search, loop=self.bot.loop)
source6 = await YTDLSource.create_source(ctx, search, loop=self.bot.loop)
except YTDLError as e:
await ctx.send('Ошибка: {}'.format(str(e)))
else:
await msg.edit(embed=discord.Embed(title="Выберите!",description="\n\n".join([source1,source2,source3,source4,source5,source6])))
wait_message = await bot.wait_for("message")
select = wait_message.content
if select == "1":
source = source1
elif select == "2":
source = source2
elif select == "3":
source = source3
elif select == "4":
source = source4
elif select == "5":
source = source5
elif select == "6":
source = source6
song = Song(source)
await ctx.voice_state.songs.put(song)
if get_lang(ctx.message) == "ru":
await msg.edit(content=f'Добавлено {source}')
elif get_lang(ctx.message) == "uk":
await msg.edit(content=f'Додано {source}')
elif get_lang(ctx.message) == "en":
await msg.edit(content=f'Added {source}')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question