diff options
author | clarkzjw <[email protected]> | 2023-02-23 00:30:52 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-02-23 12:07:32 -0800 |
commit | adb574ab528fbc4401fb7cd50b8748d1fb529450 (patch) | |
tree | 9cdcad48cc8963d1b2fccb8b4e32cd5a0b6877bc /command.py | |
parent | 770cd0ec5eb556d912bd9d200b2da76c7e3bd7c8 (diff) | |
download | swarm2fediverse-adb574ab528fbc4401fb7cd50b8748d1fb529450.tar.gz |
bot: multi user working
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: |