Revert "🥅 - Catch the error when lol_rank is used without argument"

This commit is contained in:
Florian SYLVAIN
2021-03-07 02:10:49 +01:00
parent 0d547e9c16
commit a28adac0bf
+2 -10
View File
@@ -5,6 +5,7 @@ from discord.ext.commands.cooldowns import BucketType
from private import TOKEN_RIOT from private import TOKEN_RIOT
from api_riot import rank_track, what_player from api_riot import rank_track, what_player
CD_LOLRANK = 0
class LolCmds(commands.Cog): class LolCmds(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
@@ -13,6 +14,7 @@ class LolCmds(commands.Cog):
@commands.command() @commands.command()
@commands.cooldown(1, 2, commands.BucketType.user) @commands.cooldown(1, 2, commands.BucketType.user)
async def lol_rank(self, ctx, invocator_name, x=None): async def lol_rank(self, ctx, invocator_name, x=None):
CD_LOLRANK = 0
if x is None: if x is None:
player = what_player(invocator_name) player = what_player(invocator_name)
if player != 0: if player != 0:
@@ -36,15 +38,5 @@ class LolCmds(commands.Cog):
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.') await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
@lol_rank.error
async def issou_error(self, ctx, error):
global CD_LOLRANK
if isinstance(error, commands.CommandOnCooldown) and not CD_LOLRANK:
await ctx.send(f'Please wait at least 2 seconds between each $lol_rank.')
CD_LOLRANK = 1
elif isinstance(error, commands.MissingRequiredArgument):
await ctx.send(f'Please enter an invocator name (EUW) after $lol_rank.')
def setup(bot): def setup(bot):
bot.add_cog(LolCmds(bot)) bot.add_cog(LolCmds(bot))