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 --- README.md | 12 ++++-------- callback.py | 16 ++++++++++------ prompt/string.py | 2 ++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3b0f016..2c275e4 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,15 @@ Foursquare Swarm like Telegram bot to check in at places and post to Fediverse ( - [x] Telegram native location venue checkin - [x] Telegram raw GPS location checkin - [x] Attach additional comments and medias (photos, up to 4) with checkins - -## TODO: - - [x] OAuth2 login - - Supported Fediverse software - - [x] Mastodon - - [x] Pleroma - - [ ] Misskey + - [x] Mastodon + - [x] Pleroma +## TODO: + - [ ] Option to set individual checkin visibility - [ ] Delayed checkins (Scheduled posts on Fediverse) - [ ] Connect multiple Fediverse accounts - [ ] add Telegram payment option to enable raw GPS checkins -- [ ] i18n - [ ] Anonymized usage analysis, monitoring (Grafana/Prometheus) 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) diff --git a/prompt/string.py b/prompt/string.py index 2fe13f6..e60085c 100644 --- a/prompt/string.py +++ b/prompt/string.py @@ -20,6 +20,8 @@ By using this bot, you agree to the following terms of service:\n\n PROMPT_FEDI_LOGIN_WHERE_IS_INSTANCE = "Where is your home instance in the Fediverse? (e.g. `https://mastodon.social`)" PROMPT_FEDI_LOGIN = "Please login to your Fediverse account by clicking the link below:" +PROMPT_INVALID_INSTANCE = "Your home instance (Probably a Misskey or GotoSocial instance?) is not supported. " \ + "Currently, only Mastodon or Pleroma instances are supported." PROMPT_CHOOSE_ACTION = "Use bot keyboard to choose an action" PROMPT_ADD_COMMENT = "You can continue adding comments, or press skip" PROMPT_ADD_MEDIA = "You can continue adding photos, or press skip" -- cgit v1.2.3