From a3c72516d55911325985c8c24cc94e81b6c60802 Mon Sep 17 00:00:00 2001 From: Twentysix Date: Tue, 21 Feb 2017 21:23:19 +0100 Subject: [PATCH] [Owner] [p]contact: Added a 60 seconds cooldown per user --- cogs/owner.py | 1 + red.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cogs/owner.py b/cogs/owner.py index 8bbc2e78e..026822956 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -695,6 +695,7 @@ class Owner: await self.bot.say("Alright then.") @commands.command(pass_context=True) + @commands.cooldown(1, 60, commands.BucketType.user) async def contact(self, ctx, *, message : str): """Sends message to the owner""" if self.bot.settings.owner is None: diff --git a/red.py b/red.py index 477937cf6..ed8efd5c6 100644 --- a/red.py +++ b/red.py @@ -373,7 +373,9 @@ def initialize(bot_class=Bot, formatter_class=Formatter): await bot.send_message(channel, "That command is not " "available in DMs.") elif isinstance(error, commands.CommandOnCooldown): - await bot.send_message(channel, error) + await bot.send_message(channel, "This command is on cooldown. " + "Try again in {:.2f}s" + "".format(error.retry_after)) else: bot.logger.exception(type(error).__name__, exc_info=error)