Getting cooldowns working

pull/2/head
sgoudham 5 years ago
parent 19b37678c0
commit d3813ac9d9

@ -5,6 +5,7 @@ import random
import discord
from discord.ext import commands
from discord.ext.commands import BucketType
from discord.ext.commands import cooldown
import settings
@ -17,7 +18,7 @@ class Embeds(commands.Cog):
# ~kiss command which allows users to kiss a person in the server
@commands.command(aliases=["Kiss", "kiss"])
# Added a cooldown, only 1 instance of the command can be sent every second per user
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def kissing(self, ctx, target: discord.Member):
# Surround with try/except to catch any exceptions that may occur
@ -63,7 +64,7 @@ class Embeds(commands.Cog):
# ~kill command which allows users to kill a person in the server
@commands.command(aliases=["Kill", "k"])
# Added a cooldown, only 1 instance of the command can be sent every second per user
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def kill(self, ctx, target: discord.Member):
# Surround with try/except to catch any exceptions that may occur
@ -109,7 +110,7 @@ class Embeds(commands.Cog):
# ~cuddle command which allows users to cuddle a person in the server
@commands.command(aliases=["Cuddle"])
# Added a cooldown, only 1 instance of the command can be sent every second per user
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def cuddle(self, ctx, target: discord.Member):
# Surround with try/except to catch any exceptions that may occur
@ -155,7 +156,7 @@ class Embeds(commands.Cog):
# ~slap command which allows users to cuddle a person in the server
@commands.command(aliases=["Slap"])
# Added a cooldown, only 1 instance of the command can be sent every second per user
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def slap(self, ctx, target: discord.Member):
# Surround with try/except to catch any exceptions that may occur
@ -201,7 +202,7 @@ class Embeds(commands.Cog):
# ~slap command which allows users to cuddle a person in the server
@commands.command(aliases=["Pat"])
# Added a cooldown, only 1 instance of the command can be sent every second per user
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def pat(self, ctx, target: discord.Member):
# Surround with try/except to catch any exceptions that may occur
@ -247,7 +248,7 @@ class Embeds(commands.Cog):
# ~lemon command which allows users to hand people lemons to members in the user
@commands.command(aliases=["lem", "Lemon", "Lem"])
# Added a cooldown, only 1 instance of the command can be sent every second per user
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def lemon(self, ctx, target: discord.Member):
lemon_array = ["https://media.discordapp.net/attachments/669812887564320769/720093589056520202/lemon.gif",

@ -3,7 +3,7 @@ import random
import discord
from discord.ext import commands
from discord.ext.commands import BucketType
from discord.ext.commands import BucketType, cooldown
import settings
from cogs.Embeds import error_function
@ -60,7 +60,7 @@ class Fun(commands.Cog):
# ~compliment command for everyone to use to compliment someone
@commands.command(aliases=['comp', 'Compliment', 'Comp'])
# Added a cooldown, only 1 instance of the command can be sent every second per user
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def compliment(self, ctx, target: discord.Member):
# Set up array of compliments to throw at people
@ -106,12 +106,11 @@ class Fun(commands.Cog):
# Sending out a random compliment from the array "responses"
await ctx.send(random.choice(responses))
# await ctx.send(f"{target.mention} Your wedding will be wonderful, but the y is silent <a:huh:676195228872474643> <a:huh:676195228872474643>")
# ~8Ball command
@commands.command(aliases=['8ball', '8Ball', ' 8Ball'])
# Added a cooldown, only 1 instance of the command can be sent every second per user
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def _8ball(self, ctx, *, question):
# Setting up the channels that the commands can be sent in
@ -147,7 +146,7 @@ class Fun(commands.Cog):
# ~Lukas command that only Lukas can use
@commands.command(aliases=['Lukas'])
# Added a cooldown, only 1 instance of the command can be sent every second per user
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
@commands.has_any_role('Lukas (Server Booster)')
async def lukas(self, ctx):
@ -167,7 +166,7 @@ class Fun(commands.Cog):
# ~Flip command to allow for 50/50 chance decisions
@commands.command(aliases=['Flip'])
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def flip(self, ctx):
# Define 3 arrays that only have 2 strings stored in them

@ -1,8 +1,9 @@
import asyncio
import random
from discord.ext import commands
# OwO Impowt da wibwawy ÙωÙ
from discord.ext.commands import BucketType
from discord.ext.commands import BucketType, cooldown
from owotext import OwO
# Defining an array of all the vowels in lowercase and uppercase
@ -44,7 +45,7 @@ class OwOText(commands.Cog):
# ~owo command allows for text to be 'converted to OWO'
@commands.command()
@commands.cooldown(1, 1, BucketType.user)
@cooldown(1, 1, BucketType.user)
async def owo(self, ctx):
if ctx.message.content.startswith("~owo"):
msg = ctx.message.content.split("~owo ", 1)
@ -54,8 +55,7 @@ class OwOText(commands.Cog):
await ctx.message.channel.send(owo)
""" # Bot Event for handling cooldown error
# Bot Event for handling cooldown error
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
if isinstance(error, commands.CommandOnCooldown):
@ -65,7 +65,6 @@ class OwOText(commands.Cog):
await asyncio.sleep(2.5)
# Delete the message
await message.delete()
"""
def setup(bot):

Loading…
Cancel
Save