now posts random cats

This commit is contained in:
kaylee 2024-02-23 02:21:19 +00:00
parent 51d38135dd
commit 3f888fff13
5 changed files with 13 additions and 11 deletions

View File

@ -2,9 +2,12 @@ import discord
import os
from discord.ext import commands
from dotenv import load_dotenv
import random
class CatBot():
def __init__(self):
def __init__(self, base_url, cats):
load_dotenv("./vars/.env")
intents = discord.Intents.all()
client = discord.Client(intents=intents)
@ -17,8 +20,8 @@ class CatBot():
@bot.event
async def on_message(message):
if "marco" in message.content:
await message.channel.send('polo')
if "Cat!" in message.content:
await message.channel.send(base_url + random.choice(cats))
bot.run(os.getenv('TOKEN'))

View File

@ -4,14 +4,15 @@ from bot.catbot import CatBot
from server.server import Server
SERVER_BASE_URL = "https://kaylee.wtf/cats/";
cats = []
def run_bot():
global cb
cb = CatBot()
cb = CatBot(SERVER_BASE_URL, cats)
def run_server():
global s
s = Server()
s = Server(cats)
import threading

View File

@ -1,8 +1,6 @@
import time
class Server():
def __init__(self):
i = 0
while True:
i += 1
print(i)
time.sleep(1)
def __init__(self, cats):
cats.append("cat1.jpg")
time.sleep(10)
cats.append("cat2.jpg")