How to make Discord Bot respond to multiple situations?

Viewed 36

I'm making a discord bot and I already have one "situation" down. If the user says "hi" the bot will respond back. How do I add another situation? Do I have to make another on_message function? Here's my code:

#bot.py
import os

import discord
from dotenv import load_dotenv

load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")

client = discord.Client(intents=discord.Intents.default())

@client.event
async def on_ready():
    print(f"{client.user} has connected to Discord! Yay!")

@client.event
async def on_message(message):
    if message.author==client.user:
        return
    if message.content=="hello":
        response="Hey! I'm the coolest bot you'll ever see! You can tell by my pfp."
        await message.channel.send(response)
    
client.run(TOKEN)

0 Answers
Related