Avoid sending excess messages and unnecessary state drops
This commit is contained in:
parent
697738945f
commit
3b134ae5f2
6
bot.py
6
bot.py
|
@ -486,7 +486,7 @@ def message_handling(bot, update, db):
|
||||||
delete_token(bot, update, player)
|
delete_token(bot, update, player)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
drop_state(bot, update, player)
|
if update.message.chat.type == "private":
|
||||||
send_status(bot, update, player)
|
send_status(bot, update, player)
|
||||||
|
|
||||||
elif state["state"] == "aq":
|
elif state["state"] == "aq":
|
||||||
|
@ -540,6 +540,7 @@ def message_handling(bot, update, db):
|
||||||
prefix = f"<b>Quest {quest.name} has been deleted</b>\n\n"
|
prefix = f"<b>Quest {quest.name} has been deleted</b>\n\n"
|
||||||
send_status(bot, update, player, prefix=prefix)
|
send_status(bot, update, player, prefix=prefix)
|
||||||
else:
|
else:
|
||||||
|
if update.message.chat.type == "private":
|
||||||
drop_state(bot, update, player)
|
drop_state(bot, update, player)
|
||||||
send_status(bot, update, player)
|
send_status(bot, update, player)
|
||||||
|
|
||||||
|
@ -576,10 +577,12 @@ def message_handling(bot, update, db):
|
||||||
prefix = f"<b>Side Quest {sq.name} has been deleted</b>\n\n"
|
prefix = f"<b>Side Quest {sq.name} has been deleted</b>\n\n"
|
||||||
send_status(bot, update, player, prefix=prefix)
|
send_status(bot, update, player, prefix=prefix)
|
||||||
else:
|
else:
|
||||||
|
if update.message.chat.type == "private":
|
||||||
drop_state(bot, update, player)
|
drop_state(bot, update, player)
|
||||||
send_status(bot, update, player)
|
send_status(bot, update, player)
|
||||||
|
|
||||||
elif state["state"] == "bo":
|
elif state["state"] == "bo":
|
||||||
|
if text == "back" or update.message.chat.type == "private":
|
||||||
player.set_state('none', 0)
|
player.set_state('none', 0)
|
||||||
send_status(bot, update, player)
|
send_status(bot, update, player)
|
||||||
|
|
||||||
|
@ -604,6 +607,7 @@ def message_handling(bot, update, db):
|
||||||
elif state["state"] == "rt":
|
elif state["state"] == "rt":
|
||||||
delete_token_rt(bot, update, player)
|
delete_token_rt(bot, update, player)
|
||||||
else:
|
else:
|
||||||
|
if update.message.chat.type == "private":
|
||||||
drop_state(bot, update, player)
|
drop_state(bot, update, player)
|
||||||
send_status(bot, update, player)
|
send_status(bot, update, player)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue