DEV Community

Mohammad Slaibi
Mohammad Slaibi

Posted on

Discord python bot.py

import os
import discord

TOKEN = os.getenv('DISCORD_TOKEN')

client = discord.Client()

@client.event
async def on_ready():
print(f'Logged in as {client.user}')

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

if message.content == 'Hello':
    await message.channel.send('Hello fellow humans!')
Enter fullscreen mode Exit fullscreen mode

client.run(TOKEN)

Top comments (0)