Add group support - names, /Q_, /SQ_
This commit is contained in:
parent
021467817b
commit
697738945f
25
bot.py
25
bot.py
|
@ -29,9 +29,12 @@ def escape_html(message):
|
||||||
|
|
||||||
def start(bot, update):
|
def start(bot, update):
|
||||||
chat_id = update.message.chat_id
|
chat_id = update.message.chat_id
|
||||||
name = str(update.message.from_user.first_name)
|
if update.message.chat.type == "private":
|
||||||
if update.message.from_user.last_name:
|
name = str(update.message.from_user.first_name)
|
||||||
name += " " + str(update.message.from_user.last_name)
|
if update.message.from_user.last_name:
|
||||||
|
name += " " + str(update.message.from_user.last_name)
|
||||||
|
else:
|
||||||
|
name = update.message.chat.title
|
||||||
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 = button_groups.main
|
custom_keyboard = button_groups.main
|
||||||
|
@ -65,7 +68,10 @@ def add_quest(bot, update, player, type="quest"):
|
||||||
chat_id = update.message.chat_id
|
chat_id = update.message.chat_id
|
||||||
text = ("What shall the name of " +
|
text = ("What shall the name of " +
|
||||||
{"quest": "Quest", "side_quest": "Side Quest"}[type] + " be?")
|
{"quest": "Quest", "side_quest": "Side Quest"}[type] + " be?")
|
||||||
reply_markup = telegram.ReplyKeyboardRemove()
|
if update.message.chat.type == "private":
|
||||||
|
reply_markup = telegram.ReplyKeyboardRemove()
|
||||||
|
else:
|
||||||
|
reply_markup = telegram.ForceReply()
|
||||||
bot.send_message(chat_id=chat_id, text=text, reply_markup=reply_markup)
|
bot.send_message(chat_id=chat_id, text=text, reply_markup=reply_markup)
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,9 +157,12 @@ def add_imp(bot, update, player, type, qid):
|
||||||
|
|
||||||
|
|
||||||
def send_status(bot, update, player, prefix=""):
|
def send_status(bot, update, player, prefix=""):
|
||||||
name = str(update.message.from_user.first_name)
|
if update.message.chat.type == "private":
|
||||||
if update.message.from_user.last_name:
|
name = str(update.message.from_user.first_name)
|
||||||
name += " " + str(update.message.from_user.last_name)
|
if update.message.from_user.last_name:
|
||||||
|
name += " " + str(update.message.from_user.last_name)
|
||||||
|
else:
|
||||||
|
name = update.message.chat.title
|
||||||
name = escape_html(name)
|
name = escape_html(name)
|
||||||
points = player.get_points()
|
points = player.get_points()
|
||||||
total_quests = len(player.get_quests(None))
|
total_quests = len(player.get_quests(None))
|
||||||
|
@ -247,7 +256,7 @@ def quest(bot, update, player, qid, type):
|
||||||
|
|
||||||
|
|
||||||
def quest_handling(bot, update, db):
|
def quest_handling(bot, update, db):
|
||||||
text = update.message.text.lower().split("_")
|
text = update.message.text.lower().split("@")[0].split("_")
|
||||||
chat_id = update.message.chat_id
|
chat_id = update.message.chat_id
|
||||||
player = questable.player(db, chat_id)
|
player = questable.player(db, chat_id)
|
||||||
drop_state(bot, update, player)
|
drop_state(bot, update, player)
|
||||||
|
|
Loading…
Reference in New Issue