now posts random cats
This commit is contained in:
parent
51d38135dd
commit
3f888fff13
Binary file not shown.
|
@ -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'))
|
5
main.py
5
main.py
|
@ -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
|
||||
|
||||
|
|
Binary file not shown.
|
@ -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")
|
Loading…
Reference in New Issue