title: Starting discord.py command cooldown only if condition is met
body: <p>I want the cooldown of one of my commands to start only if a condition in the function is met, like so:</p>
  
  <pre class="lang-py prettyprint-override"><code>@bot.command
  async def move(ctx, destination):
      destinations=["d1", "d2", "d3"] # List of valid arguments for the command
      if destination in destinations:
          movement(destination) # Function to actually move, not important for the question
          # Start cooldown only here
      else:
          await ctx.send("This is not a valid destination")
  
  </code></pre>
  
  <p>This way, if the user mistypes the destination, they won't be penalized with the cooldown. How can i achieve that?</p>
  
  <p>EDIT1: one would normally use discord.py's built-in @commands.cooldown decorator, here is the source:</p>
  
  <pre class="lang-py prettyprint-override"><code>def cooldown(rate, per, type=BucketType.default):
      def decorator(func):
          if isinstance(func, Command):
              func._buckets = CooldownMapping(Cooldown(rate, per, type))
          else:
              func.__commands_cooldown__ = Cooldown(rate, per, type)
          return func
      return decorator
  </code></pre>
  
  <p>However this applies to the whole command.(It is normally placed after the @bot.command decorator)</p>