-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
61 lines (41 loc) · 1.27 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import os
from threading import Thread
import flask
from discord.ext import commands
from waitress import serve
from bot.custom_bot import Bot
from conf import Conf
from utils.db_cache import DBCache
from utils.log import log, setup_logging
from utils.repl_support import get_db
#######################################################################
"""
Global Variables
"""
bot: Bot
##############################################################################
"""
HTML Control Section
Had to put them in the same file to resolve issues with getting
access to current tournament variable values
"""
web_interface = flask.Flask('Board')
@web_interface.route('/')
def home():
return flask.render_template('index.html')
def run():
serve(web_interface, host="0.0.0.0", port=80)
def display_start():
Thread(target=run).start()
##############################################################################
def main():
global bot
log('Main Started')
bot = Bot(db=DBCache(get_db()),
command_prefix=commands.when_mentioned_or(Conf.COMMAND_PREFIX),
description=Conf.BOT_DESCRIPTION)
display_start()
bot.run(os.getenv(Conf.ENV.TOKEN))
if __name__ == '__main__':
setup_logging(Conf.LOG_LEVEL)
main()