diff options
Diffstat (limited to 'callback.py')
-rw-r--r-- | callback.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/callback.py b/callback.py index 2c69fbd..e7a8308 100644 --- a/callback.py +++ b/callback.py | |||
@@ -57,6 +57,21 @@ async def process_media_group(context: CallbackContext): | |||
57 | await context.bot.send_message(chat_id=chat_id, text=PROMPT_DONE, reply_markup=MAIN_MENU) | 57 | await context.bot.send_message(chat_id=chat_id, text=PROMPT_DONE, reply_markup=MAIN_MENU) |
58 | 58 | ||
59 | 59 | ||
60 | async def callback_generate_fedi_login_url(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: | ||
61 | # generate fedi OAuth login url | ||
62 | home_instance = update.effective_message.text | ||
63 | mastodon_client = Mastodon(client_id=MASTODON_CLIENT_ID_FILE, api_base_url=home_instance) | ||
64 | oauth_url = mastodon_client.auth_request_url(redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL), | ||
65 | scopes=['write:media', 'write:statuses'], | ||
66 | state=update.effective_user.id) | ||
67 | |||
68 | await update.message.reply_text(PROMPT_FEDI_LOGIN, | ||
69 | reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Login", url=oauth_url)]]), | ||
70 | parse_mode=ParseMode.MARKDOWN) | ||
71 | |||
72 | return FEDI_LOGIN | ||
73 | |||
74 | |||
60 | async def callback_location_sharing(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: | 75 | async def callback_location_sharing(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: |
61 | if update.message.venue is not None: | 76 | if update.message.venue is not None: |
62 | context.user_data["fsq_id"] = update.message.venue.foursquare_id | 77 | context.user_data["fsq_id"] = update.message.venue.foursquare_id |