@client.command()
async def givenum(ctx):
await ctx.send("Type a number")
num1 = ctx.wait_for_message(author=ctx.author)
await ctx.send("Type a second, larger number")
num2 = ctx.wait_for_message(author=ctx.author)
try:
numb1 = int(num1)
numb2 = int(num2)
if numb1 < numb2:
value = random.randint(num1,num2)
await ctx.send(f"You got {value}.")
else:
await ctx.send(":warning: Please ensure the first number is smaller than the second number.")
except:
await ctx.send(":warning: Please use positive integers")
This is a random number generator for our discord.py bot. When we run this code is says "Type a number" but when we type a number it doesn't send anything. It doesn't even give an error. We are trying to make it respond when its non-prefixed
Aucun commentaire:
Enregistrer un commentaire