Update cooldown mechanism

Add adjustable min/max cooldown message counter
This commit is contained in:
Aadi Desai 2021-11-18 15:58:37 +00:00
parent f55d464bcf
commit f4a44f891b
No known key found for this signature in database
GPG key ID: CFFFE425830EF4D9

7
app.py
View file

@ -6,8 +6,9 @@ import random
# from discord.ext import commands # from discord.ext import commands
bot = discord.Client() bot = discord.Client()
sensitivity = 5 mincooldown = 3
counter = random.randrange(0, sensitivity) maxcooldown = 10
counter = random.randrange(mincooldown, maxcooldown)
@bot.event @bot.event
@ -33,7 +34,7 @@ async def on_message(message):
counter -= 1 counter -= 1
print("Cooldown: " + str(counter) + " messages") print("Cooldown: " + str(counter) + " messages")
else: else:
counter = random.randrange(0, sensitivity) counter = random.randrange(mincooldown, maxcooldown)
await message.reply("Hi " + reply[1] + ", I'm Dad") await message.reply("Hi " + reply[1] + ", I'm Dad")
print("Replied to " + message.author.name + " with Dad Joke") print("Replied to " + message.author.name + " with Dad Joke")
else: else: