Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ msgstr "[已编辑]"
msgid "(unsupported)"
msgstr "(不支持)"

#: efb_telegram_master/slave_message.py:793
msgid "Baidu"
msgstr "百度地图"

#: efb_telegram_master/slave_message.py:793
msgid "Gaode"
msgstr "高德地图"

#: efb_telegram_master/slave_message.py:793
msgid "Tencent"
msgstr "腾讯地图"

#: efb_telegram_master/slave_message.py:919
#: efb_telegram_master/master_message.py:310
#: efb_telegram_master/master_message.py:312
Expand Down
9 changes: 9 additions & 0 deletions efb_telegram_master/slave_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,15 @@ def slave_message_location(self, msg: Message, tg_dest: TelegramChatID, msg_temp
self.logger.debug("[%s] updated target_msg_id %s", msg.uid, target_msg_id)

location_reply_markup = self.build_chat_info_inline_keyboard(msg, msg_template, reactions, reply_markup)
name = urllib.parse.quote(html.escape(msg.text))
content = urllib.parse.quote(html.escape(msg.author.long_name))
baidu = f'https://api.map.baidu.com/marker?location={attributes.latitude},{attributes.longitude}&title={name}&content={content}&output=html&coord_type=gcj02'
# gaode require login on pc
gaode = f'https://uri.amap.com/marker?position={attributes.longitude},{attributes.latitude}&name={name}&coordinate=gaode&callnative=1'
tencent = f'https://apis.map.qq.com/uri/v1/marker?marker=coord:{attributes.latitude},{attributes.longitude};title:{content};addr:{name}'
location_reply_markup.inline_keyboard = location_reply_markup.inline_keyboard + [
[InlineKeyboardButton(self._('Baidu'), url=baidu), InlineKeyboardButton(self._('Gaode'), url=gaode), InlineKeyboardButton(self._('Tencent'), url=tencent)],
]

# TODO: Use live location if possible? Lift live location messages to EFB Framework?
return self.bot.send_location(tg_dest, latitude=attributes.latitude,
Expand Down
Loading