999catbot/bot/catbot.py

27 lines
737 B
Python
Raw Normal View History

2024-02-23 01:53:21 +00:00
import discord
import os
from discord.ext import commands
from dotenv import load_dotenv
2024-02-23 02:21:19 +00:00
import random
2024-02-23 01:53:21 +00:00
class CatBot():
2024-02-23 02:21:19 +00:00
def __init__(self, base_url, cats):
2024-02-23 01:53:21 +00:00
load_dotenv("./vars/.env")
intents = discord.Intents.all()
client = discord.Client(intents=intents)
bot = commands.Bot(command_prefix='!', intents=intents)
# Set the confirmation message when the bot is ready
@bot.event
async def on_ready():
print(f'Logged in as {bot.user.name}')
@bot.event
async def on_message(message):
2024-02-23 02:21:19 +00:00
if "Cat!" in message.content:
await message.channel.send(base_url + random.choice(cats))
2024-02-23 01:53:21 +00:00
bot.run(os.getenv('TOKEN'))