Search code examples
discordbots

How can I have a trigger without my command prefix, like welcome and not $welcome?


So I wanted to make a feature on my discord bot and I wanted it to respond when users say welcome and say Welcome! back. But every time I try it only responds to $welcome. ($ is my prefix). What should I do?

client = commands.Bot(command_prefix = "$")

@client.command()
async def welcome(ctx, message):
    if any(word in message for word in welcome):
        await message.channel.send("Welcome!")

Solution

  • @client.event
    async def on_message(message):
         if "welcome" in message.content:
               await message.channel.send('Welcome!')