diff options
Diffstat (limited to 'command.py')
-rw-r--r-- | command.py | 13 |
1 files changed, 11 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 | 5 | from dbstore.peewee_store import get_user_access_key, get_user_home_instance |
6 | from config import * | 6 | from config import * |
7 | 7 | ||
8 | 8 | ||
@@ -33,7 +33,16 @@ async def tos_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> Non | |||
33 | 33 | ||
34 | 34 | ||
35 | async def list_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: | 35 | async def list_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: |
36 | await update.message.reply_text(PROMPT_LIST, parse_mode=ParseMode.HTML, reply_markup=MAIN_MENU) | 36 | result = get_user_home_instance(str(update.effective_user.id)) |
37 | if len(result) == 0: | ||
38 | await update.message.reply_text(PROMPT_LIST_NO_RESULT, parse_mode=ParseMode.HTML) | ||
39 | else: | ||
40 | await update.message.reply_text(f"You are linked with the following Fediverse accounts:\n\n" | ||
41 | f"<b>Instance</b>: {result['home_instance']}\n" | ||
42 | f"<b>Instance type</b>: {result['home_instance_type']}\n" | ||
43 | f"<b>Default visibility</b>: {result['default_visibility']}\n", | ||
44 | parse_mode=ParseMode.HTML, | ||
45 | reply_markup=MAIN_MENU) | ||
37 | 46 | ||
38 | 47 | ||
39 | async def logout_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: | 48 | async def logout_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: |