diff --git a/efb_telegram_master/locale/zh_CN/LC_MESSAGES/efb_telegram_master.po b/efb_telegram_master/locale/zh_CN/LC_MESSAGES/efb_telegram_master.po index e017d6a0..f7890127 100644 --- a/efb_telegram_master/locale/zh_CN/LC_MESSAGES/efb_telegram_master.po +++ b/efb_telegram_master/locale/zh_CN/LC_MESSAGES/efb_telegram_master.po @@ -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 diff --git a/efb_telegram_master/slave_message.py b/efb_telegram_master/slave_message.py index 8c4e9eeb..dc5bdd67 100644 --- a/efb_telegram_master/slave_message.py +++ b/efb_telegram_master/slave_message.py @@ -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,