Add initial code for base_quest, quest, side_quest.
Also, fix typo.
This commit is contained in:
parent
f1b866c4a2
commit
7672e33b4e
2
bot.py
2
bot.py
|
@ -23,7 +23,7 @@ def start(bot, update):
|
||||||
text = f"Hello {name}!\n" + \
|
text = f"Hello {name}!\n" + \
|
||||||
"Welcome to Questable. To get started, check /help."
|
"Welcome to Questable. To get started, check /help."
|
||||||
custom_keyboard = [
|
custom_keyboard = [
|
||||||
['Add Quest', 'Add Side-quests'],
|
['Add Quest', 'Add Side-quest'],
|
||||||
['List Quests', 'List Side-quests']
|
['List Quests', 'List Side-quests']
|
||||||
]
|
]
|
||||||
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
|
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
class base_quest():
|
||||||
|
TABLE = None
|
||||||
|
|
||||||
|
def __init__(self, db, chat_id, qid, name=None, imp=None, diff=None,
|
||||||
|
state=None, date=None):
|
||||||
|
self.DB = db
|
||||||
|
self.CHAT_ID = chat_id
|
||||||
|
self.name = name
|
||||||
|
self.QID = qid
|
||||||
|
self.imp = imp
|
||||||
|
self.diff = diff
|
||||||
|
self.state = state
|
||||||
|
if date:
|
||||||
|
if isinstance(date, datetime):
|
||||||
|
self.date = date
|
||||||
|
else:
|
||||||
|
self.date = datetime.fromtimestamp(date)
|
||||||
|
else:
|
||||||
|
date = None
|
||||||
|
|
||||||
|
|
||||||
|
class quest(base_quest):
|
||||||
|
TABLE = "quests"
|
||||||
|
|
||||||
|
|
||||||
|
class side_quest(base_quest):
|
||||||
|
TABLE = "side_quests"
|
Loading…
Reference in New Issue