I don't know how to create a commandu so that the answer is ransom in Embed's message.



  • Help me create a commandu, but I don't know how to do this. And it chooses the text from the early list.



  • Setting up a list.

    random_list = ['текст1', 'текст2', 'текст3', 'текст4']
    

    We'll use the module to choose accidental value. random.choice()

    from random import choice
    

    Choose the random text and send the message.

    text = choice(random_list)
    await ctx.send(embed = discord.Embed(title = 'Вот ваше аниме', description = text, colour = discord.Colour.gold()))
    

    Full code:

    import discord
    from discord.ext import commands
    from random import choice
    

    bot = commands.Bot(command_prefix='!', intents = discord.Intents.all())

    random_list = ['текст1', 'текст2', 'текст3', 'текст4']

    @bot.command()
    async def аниме(ctx):
    text = choice(random_list)
    await ctx.send(embed = discord.Embed(title = 'Вот ваше аниме', description = text, colour = discord.Colour.gold()))

    bot.run('TOKEN')




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2