title: How to add slash commands with @client.event on_message discord-py-slash (discord.py)
body: <p>I am trying to add slash commands to my existing bot.<br>
  Currently Im using</p>
  <pre class="lang-py prettyprint-override"><code>intents = discord.Intents.all()
  client = commands.Bot(command_prefix=&quot;.&quot;, intents=intents)
  slash = SlashCommand(client, sync_commands=True)
  
  
  @client.event
  async def on_message(message):
      # do some stuff   
  
  
  @slash.slash(name=&quot;test&quot;,
               description=&quot;This is just a test command, nothing more.&quot;)
  async def test(ctx):
      await ctx.send(content=&quot;Hello World!&quot;)
  
  </code></pre>
  <p>But when I go to discord, and I type / and the command. I get
  <code>Invalid interaction application command</code></p>
  <p>I also tried this: <a href="https://stackoverflow.com/questions/66842743/discord-slash-how-to-actually-add-a-slash-command-why-isnt-mine-working">discord_slash: How to actually add a slash command/ why isn&#39;t mine working?</a>.<br>
  But I didnt understand how to ignore the /slash command in <code>on_message</code> function.
  <br>
  <br>
  <strong>Edit</strong>
  I tried printing the message.content in <code>on_message</code>, but i didnt get any.There are no errors or exceptions in terminal, when I try to execute it. I only get the error in discord.
  <a href="https://i.stack.imgur.com/KfCKb.png" rel="nofollow noreferrer">This is the only error I get.</a></p>
  <p>Thx in advance.</p>