jeudi 10 février 2022

How to Add Randomness in Discord.py

I am new to Python, I need help adding randomness into my bot on Discord. I made a command where there was a 0.01% chance of getting a message. However only the else statement worked, if the rare chance happened, no message was sent to the channel.

@client.command()
@commands.cooldown(1, 86400, commands.BucketType.user)
@commands.has_role("Member")
async def addrole(ctx):
    if random.randint(1, 10000) < 2:
        await ctx.channel.send("wow rare")

    else:
        await ctx.channel.send("not cool")



Aucun commentaire:

Enregistrer un commentaire