aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'callback.py')
-rw-r--r--callback.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/callback.py b/callback.py
index 4fe0540..aca8a90 100644
--- a/callback.py
+++ b/callback.py
@@ -3,7 +3,6 @@ from typing import cast, List
3 3
4from telegram import ReplyKeyboardRemove 4from telegram import ReplyKeyboardRemove
5from telegram.constants import ChatAction 5from telegram.constants import ChatAction
6from telegram.error import BadRequest
7from telegram.ext import CallbackContext 6from telegram.ext import CallbackContext
8 7
9from command import * 8from command import *
@@ -11,8 +10,9 @@ from dbstore.peewee_store import get_poi_by_fsq_id
11from foursquare.poi import OSM_ENDPOINT 10from foursquare.poi import OSM_ENDPOINT
12from foursquare.poi import query_poi 11from foursquare.poi import query_poi
13from config import BOT_SCOPE 12from config import BOT_SCOPE
14from dbstore.peewee_store import User, db 13from dbstore.peewee_store import User, db, TOOT_VISIBILITY_PRIVATE, TOOT_VISIBILITY_PUBLIC, TOOT_VISIBILITY_UNLISTED
15import uuid 14import uuid
15from mastodon import Mastodon
16 16
17 17
18def generate_uuid(): 18def generate_uuid():
@@ -79,8 +79,6 @@ async def callback_generate_fedi_login_url(update: Update, context: ContextTypes
79 redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL), 79 redirect_uris="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL),
80 api_base_url=home_instance, 80 api_base_url=home_instance,
81 ) 81 )
82 print("client_id: {}".format(client_id))
83 print("client_secret: {}".format(client_secret))
84 82
85 m = Mastodon(client_id=client_id, client_secret=client_secret, api_base_url=home_instance) 83 m = Mastodon(client_id=client_id, client_secret=client_secret, api_base_url=home_instance)
86 84
@@ -115,7 +113,7 @@ async def callback_location_sharing(update: Update, context: ContextTypes.DEFAUL
115 113
116 poi = get_poi_by_fsq_id(context.user_data.get("fsq_id")) 114 poi = get_poi_by_fsq_id(context.user_data.get("fsq_id"))
117 content = generate_toot_text(poi["name"], poi["locality"], poi["region"], poi["latitude"], poi["longitude"]) 115 content = generate_toot_text(poi["name"], poi["locality"], poi["region"], poi["latitude"], poi["longitude"])
118 status = get_mastodon_client(update.effective_user.id).status_post(content, visibility=DEFAULT_TOOT_VISIBILITY, media_ids=[]) 116 status = get_mastodon_client(update.effective_user.id).status_post(content, visibility=TOOT_VISIBILITY_PRIVATE, media_ids=[])
119 117
120 context.user_data[KEY_TOOT_STATUS_ID] = status["id"] 118 context.user_data[KEY_TOOT_STATUS_ID] = status["id"]
121 context.user_data[KEY_TOOT_STATUS_CONTENT] = content 119 context.user_data[KEY_TOOT_STATUS_CONTENT] = content
@@ -190,7 +188,7 @@ async def _process_location_selection(context: ContextTypes.DEFAULT_TYPE) -> int
190 else: 188 else:
191 content = generate_toot_text(poi_name, "", "", context.user_data.get("latitude"), context.user_data.get("longitude")) 189 content = generate_toot_text(poi_name, "", "", context.user_data.get("latitude"), context.user_data.get("longitude"))
192 190
193 status = get_mastodon_client(context.user_data["user_id"]).status_post(content, visibility=DEFAULT_TOOT_VISIBILITY, media_ids=[]) 191 status = get_mastodon_client(context.user_data["user_id"]).status_post(content, visibility=TOOT_VISIBILITY_PRIVATE, media_ids=[])
194 192
195 context.user_data[KEY_TOOT_STATUS_ID] = status["id"] 193 context.user_data[KEY_TOOT_STATUS_ID] = status["id"]
196 context.user_data[KEY_TOOT_STATUS_CONTENT] = content 194 context.user_data[KEY_TOOT_STATUS_CONTENT] = content
Powered by cgit v1.2.3 (git 2.41.0)