999catbot/bot/catbot.py

27 lines
737 B
Python

import discord
import os
from discord.ext import commands
from dotenv import load_dotenv
import random
class CatBot():
def __init__(self, base_url, cats):
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):
if "Cat!" in message.content:
await message.channel.send(base_url + random.choice(cats))
bot.run(os.getenv('TOKEN'))