diff options
author | clarkzjw <[email protected]> | 2023-02-23 21:18:49 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-02-23 21:19:21 -0800 |
commit | cbfde03e620188d80213a8b15a4dffdb8948b257 (patch) | |
tree | 8f92afbed1137c6f992be57a84a3101a09475acc /command.py | |
parent | d7c1835ed41d50d8e0fd42fd8c33fa760ce24bb5 (diff) | |
download | swarm2fediverse-cbfde03e620188d80213a8b15a4dffdb8948b257.tar.gz |
bot: implement /logout command
Diffstat (limited to 'command.py')
-rw-r--r-- | command.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2,7 +2,7 @@ from telegram import Update | |||
2 | from telegram.constants import ParseMode | 2 | from telegram.constants import ParseMode |
3 | from telegram.error import BadRequest | 3 | from telegram.error import BadRequest |
4 | from telegram.ext import ContextTypes, ConversationHandler | 4 | from telegram.ext import ContextTypes, ConversationHandler |
5 | from dbstore.peewee_store import get_user_access_key, get_user_home_instance | 5 | from dbstore.peewee_store import get_user_access_key, get_user_home_instance, delete_user_by_id |
6 | from config import * | 6 | from config import * |
7 | 7 | ||
8 | 8 | ||
@@ -46,7 +46,8 @@ async def list_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No | |||
46 | 46 | ||
47 | 47 | ||
48 | async def logout_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: | 48 | async def logout_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: |
49 | await update.message.reply_text(PROMPT_LOGOUT, parse_mode=ParseMode.HTML, reply_markup=MAIN_MENU) | 49 | if delete_user_by_id(str(update.effective_user.id)): |
50 | await update.message.reply_text(PROMPT_LOGOUT_SUCCESS, parse_mode=ParseMode.HTML, reply_markup=LOGIN_MENU) | ||
50 | 51 | ||
51 | 52 | ||
52 | async def toggle_visibility_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: | 53 | async def toggle_visibility_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: |