python-3.xdiscorddisnake

How to get slash command name using python for discord bot


Currently I am using on_message() for reading message.

So I would like to get the command name and call specific function based on command name.


Solution

  • If anyone is looking for the same then here is the answer:

    @client.event
    async def on_message(message):
       cmdName = message.interaction.name