From 445f8d35f5c8674db0cc42a82120ff666027bcb2 Mon Sep 17 00:00:00 2001 From: 10kilo <10kilo@noreply@swee.codes> Date: Wed, 4 Dec 2024 22:38:51 -0800 Subject: [PATCH] Integrate dashboard with bot Please bugtest this, I'm bad at python, especially threading --- sweebot.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sweebot.py b/sweebot.py index cf0830a..f5e9c14 100644 --- a/sweebot.py +++ b/sweebot.py @@ -14,6 +14,29 @@ from requests import get, exceptions as rex from bs4 import BeautifulSoup from googleapiclient.discovery import build +run = 0 +block = 0 +# Dashboard thread +from flask import Flask, send_file +app = Flask(__name__) + +@app.route('/') +def index(): + return send_file("sweebot.html", mimetype='text/html') +@app.route('/run.txt') +def run(): + wait(2) + return str(run) +@app.route('/block.txt') +def block(): + wait(2) + return str(block) +@app.route('/script.js') +def script(): + return send_file("script.js", mimetype='application/javascript') +threading.Thread(target=app.run, daemon=True) + + DEVELOPER_KEY = environ["ytapi"] headers = { 'User-Agent': 'SweeBot IRC ' + __version__ @@ -199,8 +222,6 @@ pats = ["-w-", "Meep...", "Prr!"] meows_happy = ['Meow!', 'Nyaa~', 'Mrow.', 'Prr! :3', "Mrrp?", "Mreow.", "!woeM", "3: !rrP", "~aayN", "Mew!", "Moew!"] meows_upset = ['Hiss!', "!ssiH", "Grrr..."] happiness = 5 -run = 0 -block = 0 global times times = 0 def update():