Changed debug logging logic
This commit is contained in:
@@ -34,14 +34,21 @@ async def cmd_reapply(app: Client, msg: Message):
|
||||
await welcome_pass(app, msg, once_again=True)
|
||||
|
||||
else:
|
||||
await msg.reply_text(locale("reapply_left_chat", "message", locale=holo_user), reply_markup=InlineKeyboardMarkup([
|
||||
[
|
||||
InlineKeyboardButton(locale("reapply_old_one", "button", locale=holo_user), f"reapply_old_{msg.id}")
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(locale("reapply_new_one", "button", locale=holo_user), f"reapply_new_{msg.id}")
|
||||
]
|
||||
]))
|
||||
|
||||
if holo_user.sponsorship_state()[1] is True:
|
||||
|
||||
await msg.reply_text(locale("reapply_left_chat", "message", locale=holo_user), reply_markup=InlineKeyboardMarkup([
|
||||
[
|
||||
InlineKeyboardButton(locale("reapply_old_one", "button", locale=holo_user), f"reapply_old_{msg.id}")
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(locale("reapply_new_one", "button", locale=holo_user), f"reapply_new_{msg.id}")
|
||||
]
|
||||
]))
|
||||
|
||||
else:
|
||||
holo_user.application_restart(reapply=True)
|
||||
await welcome_pass(app, msg, once_again=True)
|
||||
|
||||
else:
|
||||
|
||||
|
@@ -24,42 +24,35 @@ async def cmd_resetcommands(app: Client, msg: Message):
|
||||
if entry.endswith(".json"):
|
||||
valid_locales.append(".".join(entry.split(".")[:-1]))
|
||||
|
||||
if configGet("debug") is True:
|
||||
logWrite(f'Resetting commands in groups {configGet("admin", "groups")} and {configGet("users", "groups")}')
|
||||
logWrite(f'Resetting commands in groups {configGet("admin", "groups")} and {configGet("users", "groups")}', debug=True)
|
||||
await app.delete_bot_commands(scope=BotCommandScopeChat(chat_id=configGet("admin", "groups")))
|
||||
await app.delete_bot_commands(scope=BotCommandScopeChat(chat_id=configGet("users", "groups")))
|
||||
|
||||
for admin in configGet("admins"):
|
||||
try:
|
||||
if configGet("debug") is True:
|
||||
logWrite(f'Resetting commands for admin {admin}')
|
||||
logWrite(f'Resetting commands for admin {admin}', debug=True)
|
||||
await app.delete_bot_commands(scope=BotCommandScopeChat(chat_id=admin))
|
||||
except bad_request_400.PeerIdInvalid:
|
||||
pass
|
||||
|
||||
try:
|
||||
if configGet("debug") is True:
|
||||
logWrite(f'Resetting commands for owner {configGet("owner")}')
|
||||
logWrite(f'Resetting commands for owner {configGet("owner")}', debug=True)
|
||||
for lc in valid_locales:
|
||||
if configGet("debug") is True:
|
||||
logWrite(f'Resetting commands for owner {configGet("owner")} [{lc}]')
|
||||
logWrite(f'Resetting commands for owner {configGet("owner")} [{lc}]', debug=True)
|
||||
await app.delete_bot_commands(scope=BotCommandScopeChat(chat_id=configGet("owner")), language_code=lc)
|
||||
await app.delete_bot_commands(scope=BotCommandScopeChat(chat_id=configGet("owner")))
|
||||
except bad_request_400.PeerIdInvalid:
|
||||
pass
|
||||
|
||||
for lc in valid_locales:
|
||||
if configGet("debug") is True:
|
||||
logWrite(f'Resetting commands for locale {lc}')
|
||||
logWrite(f'Resetting commands for locale {lc}', debug=True)
|
||||
await app.delete_bot_commands(scope=BotCommandScopeDefault(), language_code=lc)
|
||||
|
||||
if configGet("debug") is True:
|
||||
logWrite(f'Resetting default commands')
|
||||
logWrite(f'Resetting default commands', debug=True)
|
||||
await app.delete_bot_commands()
|
||||
|
||||
await msg.reply_text("OK", quote=should_quote(msg))
|
||||
|
||||
if configGet("debug") is True:
|
||||
logWrite(str(await app.get_bot_commands()))
|
||||
logWrite(str(await app.get_bot_commands(scope=BotCommandScopeChat(chat_id=configGet("owner")))))
|
||||
logWrite(str(await app.get_bot_commands()), debug=True)
|
||||
logWrite(str(await app.get_bot_commands(scope=BotCommandScopeChat(chat_id=configGet("owner")))), debug=True)
|
||||
# ==============================================================================================================================
|
Reference in New Issue
Block a user