Integrate dashboard to the bot #2

Merged
swee merged 2 commits from 10kilo/MeowNex:main into main 2024-12-06 18:01:41 -08:00
Showing only changes of commit 445f8d35f5 - Show all commits

View file

@ -14,6 +14,29 @@ from requests import get, exceptions as rex
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from googleapiclient.discovery import build 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"] DEVELOPER_KEY = environ["ytapi"]
headers = { headers = {
'User-Agent': 'SweeBot IRC ' + __version__ '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_happy = ['Meow!', 'Nyaa~', 'Mrow.', 'Prr! :3', "Mrrp?", "Mreow.", "!woeM", "3: !rrP", "~aayN", "Mew!", "Moew!"]
meows_upset = ['Hiss!', "!ssiH", "Grrr..."] meows_upset = ['Hiss!', "!ssiH", "Grrr..."]
happiness = 5 happiness = 5
run = 0
block = 0
global times global times
times = 0 times = 0
def update(): def update():