-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.py
40 lines (30 loc) · 1.18 KB
/
helper.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
from discord.ext import commands
from choresCog import ChoresCog
from sqlalchemy.orm import sessionmaker
import sqlalchemy.orm
import sqlalchemy
import sys
bot = commands.Bot(command_prefix="!")
token = open("resources/APIKey.txt", "r").readline()
@bot.event
async def on_ready():
# build DB connection
from orm import tables
print("SQLAlchemy Version: {}".format(sqlalchemy.__version__)) # Mostly for debug if necessary
engine = sqlalchemy.create_engine(open("resources/mysqlEngine.txt", "r").readline(), pool_recycle=3600, echo=False)
engine.execute("CREATE DATABASE IF NOT EXISTS helper")
for arg in sys.argv:
if arg == 'testing':
print("Testing flag set!")
engine.execute("CREATE DATABASE IF NOT EXISTS helpertest")
tables.meta.create_all(bind=engine)
session = (sessionmaker(bind=engine))()
# Add cogs
bot.add_cog(ChoresCog(bot, session))
"""
cog ideas:
CookbookCog - Stores recipes as ingredients and steps, allows definition
SuggestionBoxCog - Takes feature suggestions and stores them. Probably simple, kept seperate for organization.
"""
print("H.E.L.P.eR. ready")
bot.run(token)