[Owner] [p]contact: Added a 60 seconds cooldown per user

This commit is contained in:
Twentysix 2017-02-21 21:23:19 +01:00
parent 086190cae4
commit a3c72516d5
2 changed files with 4 additions and 1 deletions

View File

@ -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:

4
red.py
View File

@ -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)