aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bot.py5
-rw-r--r--callback.py8
2 files changed, 8 insertions, 5 deletions
diff --git a/bot.py b/bot.py
index 6198bc4..3b45906 100644
--- a/bot.py
+++ b/bot.py
@@ -85,10 +85,7 @@ class FediLoginCallbackContext(CallbackContext[ExtBot, dict, dict, dict]):
85 85
86 86
87async def process_oauth_login_callback(update: FediLoginCallbackUpdate, context: FediLoginCallbackContext) -> None: 87async def process_oauth_login_callback(update: FediLoginCallbackUpdate, context: FediLoginCallbackContext) -> None:
88 combined_payloads = update.code 88 text = "Login success, your OAuth code is: {}".format(update.code)
89 text = "Login success, your code is: {}".format(combined_payloads)
90 print(text)
91 print(update.state)
92 await context.bot.send_message(chat_id=update.state, text=text) 89 await context.bot.send_message(chat_id=update.state, text=text)
93 90
94 91
diff --git a/callback.py b/callback.py
index e7a8308..d2f3ae7 100644
--- a/callback.py
+++ b/callback.py
@@ -60,7 +60,13 @@ async def process_media_group(context: CallbackContext):
60async def callback_generate_fedi_login_url(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: 60async def callback_generate_fedi_login_url(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
61 # generate fedi OAuth login url 61 # generate fedi OAuth login url
62 home_instance = update.effective_message.text 62 home_instance = update.effective_message.text
63 mastodon_client = Mastodon(client_id=MASTODON_CLIENT_ID_FILE, api_base_url=home_instance) 63 client_id, client_secret = Mastodon.create_app(
64 "Checkin.bot",
65 scopes=['write:media', 'write:statuses'],
66 redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL),
67 api_base_url=home_instance,
68 )
69 mastodon_client = Mastodon(client_id=client_id, client_secret=client_secret, api_base_url=home_instance)
64 oauth_url = mastodon_client.auth_request_url(redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL), 70 oauth_url = mastodon_client.auth_request_url(redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL),
65 scopes=['write:media', 'write:statuses'], 71 scopes=['write:media', 'write:statuses'],
66 state=update.effective_user.id) 72 state=update.effective_user.id)
Powered by cgit v1.2.3 (git 2.41.0)