Discord Bot in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
discord-minecraft-python-bot/basic_greeting_bot.py

25 lines
552 B

import discord
import os
from dotenv import load_dotenv
BOT_NAME = "MinecraftBot"
load_dotenv()
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
bot = discord.Client()
@bot.event
async def on_ready():
print(f'{bot.user} has logged in.')
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.content == 'hello':
await message.channel.send(f'Hey {message.author}')
if message.content == 'goodbye':
await message.channel.send(f'Goodbye {message.author}')
bot.run(DISCORD_TOKEN)