From 0ab2fa5b6b1ea22bb924b5312fbf7e17633b160e Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Sat, 11 May 2019 12:29:21 +0530 Subject: [PATCH] Add ls to list both quests and side quests --- bot.py | 3 +++ schema.sql | 44 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 7aea760..76e5352 100755 --- a/bot.py +++ b/bot.py @@ -482,6 +482,9 @@ def message_handling(bot, update, db): add_token(bot, update, player) elif text in ["delete token", "🧹 delete token", "dt"]: delete_token(bot, update, player) + elif text == "ls": + list_quests(bot, update, player, "side_quest") + list_quests(bot, update, player, "quest") else: if update.message.chat.type == "private": diff --git a/schema.sql b/schema.sql index 1c659de..0bb73f5 100644 --- a/schema.sql +++ b/schema.sql @@ -1,5 +1,39 @@ -CREATE TABLE IF NOT EXISTS quests(chat_id int NOT NULL, qid int NOT NULL, name varchar(255), difficulty int, importance int, state int DEFAULT 0, UNIQUE(chat_id, qid)); -CREATE TABLE IF NOT EXISTS side_quests(chat_id int NOT NULL, qid int NOT NULL, name varchar(255), difficulty int, importance int, state int DEFAULT 0, UNIQUE(chat_id, qid)); -CREATE TABLE IF NOT EXISTS points(chat_id int PRIMARY KEY, points int); -CREATE TABLE IF NOT EXISTS state(chat_id int PRIMARY KEY, state varchar(10), extra varchar(10)); -CREATE TABLE IF NOT EXISTS tokens(chat_id int, token varchar(36) PRIMARY KEY); +CREATE TABLE IF NOT EXISTS quests( + chat_id int NOT NULL, + qid int NOT NULL, + name varchar(255), + difficulty int, + importance int, + state int DEFAULT 0, + UNIQUE(chat_id, qid) +); + + +CREATE TABLE IF NOT EXISTS side_quests( + chat_id int NOT NULL, + qid int NOT NULL, + name varchar(255), + difficulty int, + importance int, + state int DEFAULT 0, + UNIQUE(chat_id, qid) +); + + +CREATE TABLE IF NOT EXISTS points( + chat_id int PRIMARY KEY, + points int + ); + + +CREATE TABLE IF NOT EXISTS state( + chat_id int PRIMARY KEY, + state varchar(10), + extra varchar(10) +); + + +CREATE TABLE IF NOT EXISTS tokens( + chat_id int, + token varchar(36) PRIMARY KEY +);