title: Discord.py silence command
body: <p>I have been asking lots of questions lately about discord.py and this is one of them.</p>
  <p>Sometimes there are those times when some people spam your discord server but kicking or banning them seems too harsh. I had the idea for a <code>silence</code> command which would delete every new message on a channel for a given amount of time.</p>
  <p>My code so far is:</p>
  <pre><code>@BSL.command(pass_context = True)
  async def silence(ctx, lenghth = None):
          if ctx.message.author.server_permissions.administrator or ctx.message.author.id == ownerID:
               global silentMode
               global silentChannel
               silentChannel = ctx.message.channel
               silentMode = True
               lenghth = int(lenghth)
               if lenghth != '':
                    await asyncio.sleep(lenghth)
                    silentMode = False
               else:
                    await asyncio.sleep(10)
                    silentMode = False
          else:
               await BSL.send_message(ctx.message.channel, 'Sorry, you do not have the permissions to do that @{}!'.format(ctx.message.author))
  </code></pre>
  <p>The code in my <code>on_message</code> section is:</p>
  <pre><code>if silentMode == True:
          await BSL.delete_message(message)
          if message.content.startswith('bsl;'):
                  await BSL.process_commands(message)
  </code></pre>
  <p>All the variables used are pre-defined at the top of the bot.</p>
  <p>My problem is that the bot deletes all new messages in all channels which it has access to. I tried putting <code>if silentChannel == ctx.message.channel</code> in the <code>on_message</code> section but this made the command stop working completely.</p>
  <p>Any suggestions as to why this is happening are much appreciated.</p>