aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'callback.py')
-rw-r--r--callback.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/callback.py b/callback.py
index a7f7181..6a09421 100644
--- a/callback.py
+++ b/callback.py
@@ -43,8 +43,6 @@ async def callback_location_sharing(update: Update, context: ContextTypes.DEFAUL
43 context.user_data["status_id"] = status["id"] 43 context.user_data["status_id"] = status["id"]
44 context.user_data["status_content"] = content 44 context.user_data["status_content"] = content
45 45
46 print("status_id", context.user_data["status_id"])
47
48 await update.message.reply_text( 46 await update.message.reply_text(
49 text=f"Selected place: {poi['name']}, \nPosted to Mastodon: {status['url']}", 47 text=f"Selected place: {poi['name']}, \nPosted to Mastodon: {status['url']}",
50 parse_mode=ParseMode.MARKDOWN, 48 parse_mode=ParseMode.MARKDOWN,
@@ -78,8 +76,6 @@ async def callback_manual_location(update: Update, context: ContextTypes.DEFAULT
78 context.user_data["status_id"] = status["id"] 76 context.user_data["status_id"] = status["id"]
79 context.user_data["status_content"] = content 77 context.user_data["status_content"] = content
80 78
81 print("status_id", context.user_data["status_id"])
82
83 await update.message.reply_text( 79 await update.message.reply_text(
84 text=f"Manually selected place: {loc}, \nPosted to Mastodon: {status['url']}", 80 text=f"Manually selected place: {loc}, \nPosted to Mastodon: {status['url']}",
85 parse_mode=ParseMode.MARKDOWN, 81 parse_mode=ParseMode.MARKDOWN,
@@ -109,8 +105,6 @@ async def callback_location_confirmation(update: Update, context: ContextTypes.D
109 context.user_data["status_id"] = status["id"] 105 context.user_data["status_id"] = status["id"]
110 context.user_data["status_content"] = content 106 context.user_data["status_content"] = content
111 107
112 print("status_id", context.user_data["status_id"])
113
114 await query.message.reply_text( 108 await query.message.reply_text(
115 text=f"Selected place: {poi['name']}, `{query.data}`\nPosted to Mastodon: {status['url']}", 109 text=f"Selected place: {poi['name']}, `{query.data}`\nPosted to Mastodon: {status['url']}",
116 parse_mode=ParseMode.MARKDOWN, 110 parse_mode=ParseMode.MARKDOWN,
@@ -125,12 +119,12 @@ async def callback_location_confirmation(update: Update, context: ContextTypes.D
125async def callback_location_keyword_search(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: 119async def callback_location_keyword_search(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
126 await context.bot.delete_message(update.effective_chat.id, context.user_data[PROMPT_LOCATION_KEYWORD]) 120 await context.bot.delete_message(update.effective_chat.id, context.user_data[PROMPT_LOCATION_KEYWORD])
127 121
128 location_search = update.effective_message.text 122 location_search_keyword = update.effective_message.text
129 latitude = context.user_data["latitude"] 123 latitude = context.user_data["latitude"]
130 longitude = context.user_data["longitude"] 124 longitude = context.user_data["longitude"]
131 125
132 keyboard = [] 126 keyboard = []
133 poi_result = query_poi(location_search, latitude, longitude) 127 poi_result = query_poi(location_search_keyword, latitude, longitude)
134 if len(poi_result) == 0: 128 if len(poi_result) == 0:
135 poi_result = query_poi("", latitude, longitude) 129 poi_result = query_poi("", latitude, longitude)
136 130
@@ -140,13 +134,13 @@ async def callback_location_keyword_search(update: Update, context: ContextTypes
140 ]) 134 ])
141 135
142 if len(keyboard) == 0: 136 if len(keyboard) == 0:
143 await update.message.reply_text(PROMPT_NO_NEARBY_POI) 137 msg = await update.message.reply_text(PROMPT_NO_NEARBY_POI)
144 return LOCATION_CONFIRMATION
145 else: 138 else:
146 reply_markup = InlineKeyboardMarkup(keyboard) 139 reply_markup = InlineKeyboardMarkup(keyboard)
147 context.user_data["location_search"] = location_search 140 context.user_data["location_search"] = location_search_keyword
148 await update.message.reply_text(PROMPT_CHOOSE_POI_FROM_LIST, reply_markup=reply_markup) 141 msg = await update.message.reply_text(PROMPT_CHOOSE_POI_FROM_LIST, reply_markup=reply_markup)
149 142
143 context.user_data[PROMPT_CHOOSE_POI_FROM_LIST] = msg.message_id
150 return LOCATION_CONFIRMATION 144 return LOCATION_CONFIRMATION
151 145
152 146
@@ -188,7 +182,9 @@ async def callback_add_comment(update: Update, context: ContextTypes.DEFAULT_TYP
188 182
189async def callback_skip_comment(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: 183async def callback_skip_comment(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
190 await context.bot.delete_message(update.effective_chat.id, context.user_data[PROMPT_ADD_COMMENT]) 184 await context.bot.delete_message(update.effective_chat.id, context.user_data[PROMPT_ADD_COMMENT])
191 prompt_attach_photo_msg = await update.message.reply_text(PROMPT_ADD_MEDIA, reply_markup=INLINE_SKIP_MENU) 185 prompt_attach_photo_msg = await context.bot.send_message(chat_id=update.effective_chat.id,
186 text=PROMPT_ADD_MEDIA,
187 reply_markup=INLINE_SKIP_MENU)
192 context.user_data[PROMPT_ADD_MEDIA] = prompt_attach_photo_msg.message_id 188 context.user_data[PROMPT_ADD_MEDIA] = prompt_attach_photo_msg.message_id
193 return ADD_MEDIA 189 return ADD_MEDIA
194 190
Powered by cgit v1.2.3 (git 2.41.0)