N
N
NoyneimRusskiy552021-01-16 16:10:57
Python
NoyneimRusskiy55, 2021-01-16 16:10:57

How to make the bot randomly select 10 people from those who have a role?

Hello. I'm making a bot and ran into a problem. It is necessary to make sure that those who have a special role in the discord are randomized on command, and 10 users with a role are randomly selected. Then the bot tagged them in the discord chat. Tried to do it via list. I also tried to make sure that he did not choose those who had already been selected. Here is the code. Thanks in advance to anyone who can help!

List = []
team = []
team1 = []

@bot.command()
async def Участвую(ctx):

    author = ctx.message.author
    List.append(author)

    await ctx.send(f'Участвует {author.mention}!')


@bot.command()
async def Ладдер(ctx):


    List.remove(await ctx.send(random.choice(List)))
    List.remove(await ctx.send(random.choice(List)))
    List.remove(await ctx.send(random.choice(List)))
    List.remove(await ctx.send(random.choice(List)))
    List.remove(await ctx.send(random.choice(List)))

    for x in team:
        await ctx.send(x)


    List.remove(await ctx.send(random.choice(List)))
    List.remove(await ctx.send(random.choice(List)))
    List.remove(await ctx.send(random.choice(List)))
    List.remove(await ctx.send(random.choice(List)))
    List.remove(await ctx.send(random.choice(List)))
    for m in team1:
        await ctx.send(m)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question