aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbot.py1
-rw-r--r--cogs/errorhandler.py20
-rwxr-xr-xcogs/src.py1
-rwxr-xr-xcogs/utils.py8
4 files changed, 22 insertions, 8 deletions
diff --git a/bot.py b/bot.py
index 320a805..77b1562 100755
--- a/bot.py
+++ b/bot.py
@@ -16,6 +16,7 @@ extensions = [
# "cogs.webserver",
# "cogs.twitter",
"cogs.logs",
+ "cogs.errorhandler"
]
diff --git a/cogs/errorhandler.py b/cogs/errorhandler.py
new file mode 100644
index 0000000..8533a61
--- /dev/null
+++ b/cogs/errorhandler.py
@@ -0,0 +1,20 @@
+from discord.ext import commands
+
+
+class Errorhandler(commands.Cog):
+ def __init__(self, bot):
+ self.bot = bot
+
+ @commands.Cog.listener()
+ async def on_command_error(self, ctx, error):
+ if isinstance(error, commands.CommandNotFound):
+ return
+
+ if isinstance(error, commands.CommandOnCooldown):
+ return await ctx.send(f'{ctx.author.mention}, you have to wait {round(error.retry_after, 2)} seconds before using this again')
+
+ raise error
+
+
+def setup(bot):
+ bot.add_cog(Errorhandler(bot))
diff --git a/cogs/src.py b/cogs/src.py
index 81285a1..d2da654 100755
--- a/cogs/src.py
+++ b/cogs/src.py
@@ -332,6 +332,7 @@ class Src(commands.Cog):
async def is_mod(ctx):
return ctx.author.guild_permissions.manage_channels
+ @commands.cooldown(300, 1, commands.BucketType.guild)
@commands.command(description="Posts all pending runs to #pending-runs")
@commands.guild_only()
async def pending(self, ctx):
diff --git a/cogs/utils.py b/cogs/utils.py
index 3caca9e..1d3f3a8 100755
--- a/cogs/utils.py
+++ b/cogs/utils.py
@@ -366,14 +366,6 @@ class Utils(commands.Cog):
"https://aninternettroll.github.io/mcbeVerifierLeaderboard/"
)
- @leaderboard.error
- async def leaderboard_handler(self, ctx, error):
- if isinstance(error, commands.CommandOnCooldown):
- # return
- await ctx.send(
- f"{discord.utils.escape_mentions(ctx.message.author.display_name)}, you have to wait {round(error.retry_after, 2)} seconds before using this again."
- )
-
@commands.cooldown(1, 60, commands.BucketType.guild)
@commands.command()
async def someone(self, ctx):