Add get_quest, get_side_quest to player.
This commit is contained in:
parent
b3093fa1a4
commit
2a5ae51d71
22
questable.py
22
questable.py
|
@ -157,6 +157,28 @@ class player():
|
||||||
quests.append(q)
|
quests.append(q)
|
||||||
return quests
|
return quests
|
||||||
|
|
||||||
|
def get_quest(self, qid):
|
||||||
|
cursor = self.DB.cursor()
|
||||||
|
query = ('SELECT chat_id, qid, name, importance, difficulty, '
|
||||||
|
'state FROM quests WHERE chat_id = ? AND qid = ?')
|
||||||
|
cursor.execute(query, (self.CHAT_ID, qid))
|
||||||
|
row = cursor.fetchone()
|
||||||
|
if row is None:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return quest(self.DB, *row)
|
||||||
|
|
||||||
|
def get_side_quest(self, qid):
|
||||||
|
cursor = self.DB.cursor()
|
||||||
|
query = ('SELECT chat_id, qid, name, importance, difficulty, '
|
||||||
|
'state FROM quests WHERE chat_id = ? AND qid = ?')
|
||||||
|
cursor.execute(query, (self.CHAT_ID, qid))
|
||||||
|
row = cursor.fetchone()
|
||||||
|
if row is None:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return side_quest(self.DB, *row)
|
||||||
|
|
||||||
def get_tokens(self):
|
def get_tokens(self):
|
||||||
cursor = self.DB.cursor()
|
cursor = self.DB.cursor()
|
||||||
query = ('SELECT token FROM tokens WHERE chat_id=?')
|
query = ('SELECT token FROM tokens WHERE chat_id=?')
|
||||||
|
|
Loading…
Reference in New Issue