aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-02-23 21:11:05 -0800
committerclarkzjw <[email protected]>2023-02-23 21:19:14 -0800
commitd7c1835ed41d50d8e0fd42fd8c33fa760ce24bb5 (patch)
treeeecdaec4da3dd914dd72c9bda264b038aee0343b /command.py
parent1e448735a15b633cb7743a01ce6249a506196ab8 (diff)
downloadswarm2fediverse-d7c1835ed41d50d8e0fd42fd8c33fa760ce24bb5.tar.gz
bot: implement /list command
Diffstat (limited to 'command.py')
-rw-r--r--command.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/command.py b/command.py
index 22f7066..6feeec7 100644
--- a/command.py
+++ b/command.py
@@ -2,7 +2,7 @@ from telegram import Update
2from telegram.constants import ParseMode 2from telegram.constants import ParseMode
3from telegram.error import BadRequest 3from telegram.error import BadRequest
4from telegram.ext import ContextTypes, ConversationHandler 4from telegram.ext import ContextTypes, ConversationHandler
5from dbstore.peewee_store import get_user_access_key 5from dbstore.peewee_store import get_user_access_key, get_user_home_instance
6from config import * 6from 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
35async def list_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: 35async 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
39async def logout_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: 48async def logout_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
Powered by cgit v1.2.3 (git 2.41.0)