diff options
Diffstat (limited to 'callback.py')
-rw-r--r-- | callback.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/callback.py b/callback.py index 1abef5e..cb6a8d3 100644 --- a/callback.py +++ b/callback.py | |||
@@ -60,7 +60,7 @@ async def process_media_group(context: CallbackContext): | |||
60 | 60 | ||
61 | with db.connection_context(): | 61 | with db.connection_context(): |
62 | u = User.get(User.telegram_user_id == context.user_data["user_id"]) | 62 | u = User.get(User.telegram_user_id == context.user_data["user_id"]) |
63 | content_type = "text/markdown" if u.home_instance_type == "pleroma" else "text/plain" | 63 | content_type = "text/markdown" if u.home_instance_type == "pleroma" else None |
64 | 64 | ||
65 | for media_dict in context.job.data: | 65 | for media_dict in context.job.data: |
66 | if len(media_id) >= 4: | 66 | if len(media_id) >= 4: |
@@ -124,11 +124,11 @@ async def callback_location_sharing(update: Update, context: ContextTypes.DEFAUL | |||
124 | poi = query_poi_by_fsq_id(context.user_data.get("fsq_id")) | 124 | poi = query_poi_by_fsq_id(context.user_data.get("fsq_id")) |
125 | content = generate_toot_text(poi["name"], poi["locality"], poi["region"], poi["latitude"], poi["longitude"]) | 125 | content = generate_toot_text(poi["name"], poi["locality"], poi["region"], poi["latitude"], poi["longitude"]) |
126 | 126 | ||
127 | with db.connection_context(): | 127 | u = get_user_by_id(str(update.effective_user.id)) |
128 | u = User.get(User.telegram_user_id == update.effective_user.id) | 128 | content_type = "text/markdown" if u["home_instance_type"] == "pleroma" else None |
129 | content_type = "text/markdown" if u.home_instance_type == "pleroma" else "text/plain" | 129 | |
130 | status = get_mastodon_client(update.effective_user.id).status_post(content, | 130 | status = get_mastodon_client(update.effective_user.id).status_post(content, |
131 | visibility=TOOT_VISIBILITY_PRIVATE, | 131 | visibility=u["tool_visibility"], |
132 | content_type=content_type, | 132 | content_type=content_type, |
133 | media_ids=[]) | 133 | media_ids=[]) |
134 | 134 | ||
@@ -208,12 +208,11 @@ async def _process_location_selection(context: ContextTypes.DEFAULT_TYPE) -> int | |||
208 | content = generate_toot_text(poi_name, "", "", context.user_data.get("latitude"), | 208 | content = generate_toot_text(poi_name, "", "", context.user_data.get("latitude"), |
209 | context.user_data.get("longitude")) | 209 | context.user_data.get("longitude")) |
210 | 210 | ||
211 | with db.connection_context(): | 211 | u = get_user_by_id(context.user_data["user_id"]) |
212 | u = User.get(User.telegram_user_id == context.user_data["user_id"]) | 212 | content_type = "text/markdown" if u["home_instance_type"] == "pleroma" else None |
213 | content_type = "text/markdown" if u.home_instance_type == "pleroma" else "text/plain" | ||
214 | 213 | ||
215 | status = get_mastodon_client(context.user_data["user_id"]).status_post(content, | 214 | status = get_mastodon_client(context.user_data["user_id"]).status_post(content, |
216 | visibility=TOOT_VISIBILITY_PRIVATE, | 215 | visibility=u["toot_visibility"], |
217 | content_type=content_type, | 216 | content_type=content_type, |
218 | media_ids=[]) | 217 | media_ids=[]) |
219 | 218 | ||
@@ -268,7 +267,7 @@ async def callback_add_comment(update: Update, context: ContextTypes.DEFAULT_TYP | |||
268 | 267 | ||
269 | with db.connection_context(): | 268 | with db.connection_context(): |
270 | u = User.get(User.telegram_user_id == context.user_data["user_id"]) | 269 | u = User.get(User.telegram_user_id == context.user_data["user_id"]) |
271 | content_type = "text/markdown" if u.home_instance_type == "pleroma" else "text/plain" | 270 | content_type = "text/markdown" if u.home_instance_type == "pleroma" else None |
272 | 271 | ||
273 | comment = update.effective_message.text | 272 | comment = update.effective_message.text |
274 | get_mastodon_client(update.effective_user.id).status_update(id=context.user_data.get(KEY_TOOT_STATUS_ID), | 273 | get_mastodon_client(update.effective_user.id).status_update(id=context.user_data.get(KEY_TOOT_STATUS_ID), |
@@ -329,7 +328,7 @@ async def callback_add_media(update: Update, context: CallbackContext): | |||
329 | 328 | ||
330 | with db.connection_context(): | 329 | with db.connection_context(): |
331 | u = User.get(User.telegram_user_id == context.user_data["user_id"]) | 330 | u = User.get(User.telegram_user_id == context.user_data["user_id"]) |
332 | content_type = "text/markdown" if u.home_instance_type == "pleroma" else "text/plain" | 331 | content_type = "text/markdown" if u.home_instance_type == "pleroma" else None |
333 | 332 | ||
334 | mastodon_client.status_update(status=status_content, | 333 | mastodon_client.status_update(status=status_content, |
335 | id=status_id, | 334 | id=status_id, |