Discord Bot

 avatar
user_9363972
python
a year ago
1.0 kB
2
Indexable
Never
import discord
import random

# Connection
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)


# Testing
@client.event
async def on_ready():
    print(f"We have logged in as {client.user}")


words = ["sad", "depressed", "angry", "hurting", "stressed"]

feedbacks = [
    "Cheer up! 🤗",
    "Hang in there 😉",
    "You are a great person!👍 ",
    "Come on! You can do it! 💪",
    "Stay strong 🥰 ",
]


# Running
@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith("$hello"):
        await message.channel.send("Hello Also")

    if any(word in message.content for word in words):
        await message.channel.send(
            random.choice(feedbacks)
            + "\n https://media.giphy.com/media/jHdFwWJK4tY3lhoae4/giphy.gif"
        )


client.run("MTE1ODM3NDgwMDExNzQ3NzQyNg.G356gc.9-tDpDX20_J7R0ZTOzbmWD8mDGqnARX92Y3Ods")