first commit

This commit is contained in:
kaylee 2024-02-23 01:53:21 +00:00
parent 78c466dc89
commit 51d38135dd
6 changed files with 60 additions and 0 deletions

Binary file not shown.

24
bot/catbot.py Normal file
View File

@ -0,0 +1,24 @@
import discord
import os
from discord.ext import commands
from dotenv import load_dotenv
class CatBot():
def __init__(self):
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 "marco" in message.content:
await message.channel.send('polo')
bot.run(os.getenv('TOKEN'))

26
main.py Normal file
View File

@ -0,0 +1,26 @@
import os
import time
from bot.catbot import CatBot
from server.server import Server
SERVER_BASE_URL = "https://kaylee.wtf/cats/";
def run_bot():
global cb
cb = CatBot()
def run_server():
global s
s = Server()
import threading
# run bot (and server which allows users to upload cat images)
if __name__=="__main__":
t1 = threading.Thread(target=run_bot)
t2 = threading.Thread(target=run_server)
t1.start()
t2.start()
t1.join()
t2.join()
print("done")

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
discord.py==2.3.2
python-dotenv==1.0.1

Binary file not shown.

8
server/server.py Normal file
View File

@ -0,0 +1,8 @@
import time
class Server():
def __init__(self):
i = 0
while True:
i += 1
print(i)
time.sleep(1)