B
B
bubnaz2021-09-01 17:46:58
Python
bubnaz, 2021-09-01 17:46:58

Can't get a discord bot to display a random number via embed?

The code that didn't work:

from random import randint

N=1
array=list()
for i in range (N):
    array.append (randint(0,100))

@bot.command()
async def random(ctx):
    embed = discord.Embed(
        title="Число выпало (array)",
    )
    await ctx.send(embed=embed)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-09-01
@bubnaz

Well, for starters, the string "Number dropped (array)" will look like this. She will not make any substitution. If you need an f-string , then it is written differently: f"The number fell {array}"
Second, why do you generate a list of numbers once, when the bot starts, instead of generating a single number when processing the command?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question