diff options
Diffstat (limited to 'callback.py')
-rw-r--r-- | callback.py | 16 |
1 files changed, 10 insertions, 6 deletions
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): | |||
82 | 82 | ||
83 | async def callback_generate_fedi_login_url(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: | 83 | async def callback_generate_fedi_login_url(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: |
84 | home_instance = update.effective_message.text | 84 | home_instance = update.effective_message.text |
85 | client_id, client_secret = Mastodon.create_app( | 85 | try: |
86 | "Checkin.bot", | 86 | client_id, client_secret = Mastodon.create_app( |
87 | scopes=BOT_SCOPE, | 87 | "Checkin.bot", |
88 | redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL), | 88 | scopes=BOT_SCOPE, |
89 | api_base_url=home_instance, | 89 | redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL), |
90 | ) | 90 | api_base_url=home_instance, |
91 | ) | ||
92 | except KeyError as e: | ||
93 | await update.message.reply_text(PROMPT_INVALID_INSTANCE) | ||
94 | return FEDI_LOGIN | ||
91 | 95 | ||
92 | m = Mastodon(client_id=client_id, client_secret=client_secret, api_base_url=home_instance) | 96 | m = Mastodon(client_id=client_id, client_secret=client_secret, api_base_url=home_instance) |
93 | 97 | ||