Integrate dashboard to the bot #2
1 changed files with 21 additions and 2 deletions
23
sweebot.py
23
sweebot.py
|
@ -14,6 +14,27 @@ 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():
|
||||
return str(run)
|
||||
@app.route('/block.txt')
|
||||
def block():
|
||||
return str(block)
|
||||
@app.route('/script.js')
|
||||
def script():
|
||||
return send_file("script.js", mimetype='application/javascript')
|
||||
threading.Thread(target=app.run, daemon=True, kwargs={"port": 2005}).start()
|
||||
|
||||
|
||||
DEVELOPER_KEY = environ["ytapi"]
|
||||
headers = {
|
||||
'User-Agent': 'SweeBot IRC ' + __version__
|
||||
|
@ -199,8 +220,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():
|
||||
|
|
Loading…
Reference in a new issue