Browse Source

Add initial shortcuts

master
Ceda EI 3 years ago
parent
commit
0a41d3d868
  1. 66
      bot.py

66
bot.py

@ -98,11 +98,11 @@ def add_name(bot, update, player, type, qid):
def add_diff(bot, update, player, type, qid):
message = update.message.text.lower()
chat_id = update.message.chat_id
if message == "low" or message == "📙 low":
if message in ["low", "📙 low", "l"]:
diff = 1
elif message == "medium" or message == "📘 medium":
elif message in ["medium", "📘 medium", "m"]:
diff = 2
elif message == "high" or message == "📗 high":
elif message in ["high", "📗 high", "h"]:
diff = 3
else:
bot.send_message(chat_id=chat_id, text="Invalid Option")
@ -129,11 +129,11 @@ def add_diff(bot, update, player, type, qid):
def add_imp(bot, update, player, type, qid):
message = update.message.text.lower()
chat_id = update.message.chat_id
if message == "low" or message == "🔹 low":
if message in ["low", "🔹 low", "l"]:
imp = 1
elif message == "medium" or message == "🔸 medium":
elif message in ["medium", "🔸 medium", "m"]:
imp = 2
elif message == "high" or message == "🔺 high":
elif message in ["high", "🔺 high", "h"]:
imp = 3
else:
bot.send_message(chat_id=chat_id, text="Invalid Option")
@ -305,11 +305,11 @@ def edit_quest(bot, update, player, qid, target, type):
text = "<b>☑️ Updated Name</b>"
elif target == "imp":
message = message.lower()
if message == "low" or message == "🔹 low":
if message in ["low", "🔹 low", "l"]:
x.imp = 1
elif message == "medium" or message == "🔸 medium":
elif message in ["medium", "🔸 medium", "m"]:
x.imp = 2
elif message == "high" or message == "🔺 high":
elif message in ["high", "🔺 high", "h"]:
x.imp = 3
else:
bot.send_message(chat_id=chat_id, text="Invalid Option")
@ -317,11 +317,11 @@ def edit_quest(bot, update, player, qid, target, type):
text = "<b>☑️ Updated Priority</b>"
elif target == "diff":
message = message.lower()
if message == "low" or message == "📙 low":
if message in ["low", "📙 low", "l"]:
x.diff = 1
elif message == "medium" or message == "📘 medium":
elif message in ["medium", "📘 medium", "m"]:
x.diff = 2
elif message == "high" or message == "📗 high":
elif message in ["high", "📗 high", "h"]:
x.diff = 3
else:
bot.send_message(chat_id=chat_id, text="Invalid Option")
@ -466,23 +466,21 @@ def message_handling(bot, update, db):
# rt: Remove token
if state["state"] == "none":
if text == "add quest" or text == "❇️ add quest":
if text in ["add quest", "❇️ add quest", "aq"]:
add_quest(bot, update, player)
elif text == "add side quest" or text == "📯 add side quest":
elif text in ["add side quest", "📯 add side quest", "asq"]:
add_quest(bot, update, player, "side_quest")
elif text == "list quests" or text == "📜 list quests":
elif text in ["list quests", "📜 list quests", "lq"]:
list_quests(bot, update, player, "quest")
elif text == "list side quests" or text == "📃 list side quests":
elif text in ["list side quests", "📃 list side quests", "lsq"]:
list_quests(bot, update, player, "side_quest")
elif text == "tokens" or text == "🔑 tokens":
elif text in ["tokens", "🔑 tokens", "t"]:
tokens(bot, update)
elif text == "list tokens" or text == "📋 list tokens":
elif text in ["list tokens", "📋 list tokens", "lt"]:
list_tokens(bot, update, player)
elif text == "generate token" or text == "🔑 generate token":
elif text in ["generate token", "🔑 generate token", "gt"]:
add_token(bot, update, player)
elif text == "delete token" or text == "🧹 delete token":
elif text in ["delete token", "🧹 delete token", "dt"]:
delete_token(bot, update, player)
else:
@ -508,32 +506,32 @@ def message_handling(bot, update, db):
add_imp(bot, update, player, "side_quest", state["extra"])
elif state["state"] == "eq":
if text == "back" or text == "⬅️ back":
if text in ["back", "⬅️ back", "b"]:
player.set_state('none', 0)
send_status(bot, update, player)
elif text == "mark as done" or text == "✅ mark as done":
elif text in ["mark as done", "✅ mark as done", "mad"]:
mark_as_done(bot, update, player, state["extra"], "quest")
elif text == "edit name" or text == "📝 edit name":
elif text in ["edit name", "📝 edit name", "en"]:
player.set_state('eqn', state["extra"])
text = "What shall the new name of the Quest be?"
reply_markup = telegram.ReplyKeyboardRemove()
bot.send_message(chat_id=player.CHAT_ID, text=text,
reply_markup=reply_markup)
elif text == "change priority" or text == "⚠️ change priority":
elif text in ["change priority", "⚠️ change priority", "cp"]:
player.set_state('eqi', state["extra"])
text = "How important is it?"
custom_keyboard = button_groups.importance
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
bot.send_message(chat_id=player.CHAT_ID, text=text,
reply_markup=reply_markup)
elif text == "change difficulty" or text == "📚 change difficulty":
elif text in ["change difficulty", "📚 change difficulty", "cd"]:
player.set_state('eqd', state["extra"])
text = "How difficult is it?"
custom_keyboard = button_groups.difficulty
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
bot.send_message(chat_id=player.CHAT_ID, text=text,
reply_markup=reply_markup)
elif text == "delete quest" or text == "🗑 delete quest":
elif text in ["delete quest", "🗑 delete ques", "dq"]:
quest = questable.get_quest(db, player.CHAT_ID, state["extra"])
quest.delete_from_db()
drop_state(bot, update, player)
@ -545,32 +543,32 @@ def message_handling(bot, update, db):
send_status(bot, update, player)
elif state["state"] == "esq":
if text == "back" or text == "⬅️ back":
if text in ["back", "⬅️ back", "b"]:
player.set_state('none', 0)
send_status(bot, update, player)
elif text == "mark as done" or text == "✅ mark as done":
elif text in ["mark as done", "✅ mark as done", "mad"]:
mark_as_done(bot, update, player, state["extra"], "side_quest")
elif text == "edit name" or text == "📝 edit name":
elif text in ["edit name", "📝 edit name", "en"]:
player.set_state('esqn', state["extra"])
text = "What shall the new name of the Side Quest be?"
reply_markup = telegram.ReplyKeyboardRemove()
bot.send_message(chat_id=player.CHAT_ID, text=text,
reply_markup=reply_markup)
elif text == "change priority" or text == "⚠️ change priority":
elif text in ["change priority", "⚠️ change priority", "cp"]:
player.set_state('esqi', state["extra"])
text = "How important is it?"
custom_keyboard = button_groups.importance
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
bot.send_message(chat_id=player.CHAT_ID, text=text,
reply_markup=reply_markup)
elif text == "change difficulty" or text == "📚 change difficulty":
elif text in ["change difficulty", "📚 change difficulty", "cd"]:
player.set_state('esqd', state["extra"])
text = "How difficult is it?"
custom_keyboard = button_groups.difficulty
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
bot.send_message(chat_id=player.CHAT_ID, text=text,
reply_markup=reply_markup)
elif text == "delete side quest" or text == "🗑 delete side quest":
elif text in ["delete side quest", "🗑 delete side quest", "dsq"]:
sq = questable.get_side_quest(db, player.CHAT_ID, state["extra"])
sq.delete_from_db()
drop_state(bot, update, player)

Loading…
Cancel
Save