diff options
Diffstat (limited to 'command.py')
-rw-r--r-- | command.py | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -2,15 +2,21 @@ 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 | 5 | from dbstore.peewee_store import get_user_access_key | |
6 | from config import * | 6 | from config import * |
7 | 7 | ||
8 | 8 | ||
9 | async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: | 9 | async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: |
10 | await update.message.reply_text(PROMPT_START, parse_mode=ParseMode.MARKDOWN) | 10 | await update.message.reply_text(PROMPT_START, parse_mode=ParseMode.MARKDOWN) |
11 | await update.message.reply_text(PROMPT_CHOOSE_ACTION, reply_markup=MAIN_MENU) | 11 | user_access_key = get_user_access_key(str(update.effective_user.id)) |
12 | 12 | # TODO | |
13 | return WAIT_LOCATION | 13 | # verify user access key still valid |
14 | if len(user_access_key) == 0: | ||
15 | await update.message.reply_text(PROMPT_FEDI_LOGIN_WHERE_IS_INSTANCE, parse_mode=ParseMode.MARKDOWN) | ||
16 | return FEDI_LOGIN | ||
17 | else: | ||
18 | await update.message.reply_text(PROMPT_CHOOSE_ACTION, reply_markup=MAIN_MENU) | ||
19 | return WAIT_LOCATION | ||
14 | 20 | ||
15 | 21 | ||
16 | async def fedi_login_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: | 22 | async def fedi_login_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: |