From 0808f28fa7764694c0e52ce68e077dcbf05be322 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Mon, 27 Feb 2023 15:18:48 -0800 Subject: misskey is not supported --- callback.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'callback.py') diff --git a/callback.py b/callback.py index cb6a8d3..7530afb 100644 --- a/callback.py +++ b/callback.py @@ -82,12 +82,16 @@ async def process_media_group(context: CallbackContext): async def callback_generate_fedi_login_url(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: home_instance = update.effective_message.text - client_id, client_secret = Mastodon.create_app( - "Checkin.bot", - scopes=BOT_SCOPE, - redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL), - api_base_url=home_instance, - ) + try: + client_id, client_secret = Mastodon.create_app( + "Checkin.bot", + scopes=BOT_SCOPE, + redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL), + api_base_url=home_instance, + ) + except KeyError as e: + await update.message.reply_text(PROMPT_INVALID_INSTANCE) + return FEDI_LOGIN m = Mastodon(client_id=client_id, client_secret=client_secret, api_base_url=home_instance) -- cgit v1.2.3