Answer the question
In order to leave comments, you need to log in
How to use the discord.py library to accept a response to a message and store it in a variable?
I've searched a lot, but I haven't found an answer to the above question anywhere.
My bot should create a notification for all participants that at such and such a time, on such and such an IP, a survey will be made. And another comment.
Here is my code:
@bot.command()
async def video(ctx, *, text):
author = ctx.message.author
if get(author.roles, name="Босс"):
await ctx.send(f'Введите время проведение съемок в формате ЧЧ:ММ')
time = await bot.wait_for('message')
await ctx.send(f'Теперь введите IP сервера съемок, как он есть')
serverip = await bot.wait_for('message')
await ctx.send(f'Теперь введите любой комментарий')
comment = await bot.wait_for('message')
embed = discord.Embed(color = discord.Color.red(), title ="**Запланированы сьемки!**", description = '**Время: **' + str(time) + '\n' + '**IP Сервера: **' + str(serverip) + '\n' + '**Комментарий: **' + str(comment) + '\n\n' + '<@everyone>')
await ctx.send(embed = embed)
elif text == "?":
embed = discord.Embed(color = 0xff9900, description = '', title = 'Команда **video**' + "\n" + "\n" + 'Позволяет быстро объявить о предстоящем видео' + "\n" + "Использование: **_/video set_**")
await ctx.send(embed=embed)
else:
await ctx.send(f'Для использования этой команды нужно обладать ролью <@Босс>. К сожалению, у Вас такой роли не обнаружено')
Answer the question
In order to leave comments, you need to log in
Here and in other wait_fors, you get a Message object.
time = await bot.wait_for('message')
serverip = await bot.wait_for('message')
embed = discord.Embed(color = discord.Color.red(), title ="**Запланированы сьемки!**", description = '**Время: **' + time.content + '\n' + '**IP Сервера: **' + serverip.content + '\n' + '**Комментарий: **' + comment.content + '\n\n' + '<@everyone>')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question