From 3de9471c2e43bf68d9853e7f4b4c600cffa8fd17 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Tue, 18 May 2021 09:23:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E5=8F=91telegram=E6=97=B6=E5=B0=86=20?= =?UTF-8?q?#=20=E6=9B=BF=E6=8D=A2=E4=B8=BA=20=E4=BA=95=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E8=A2=AB=E5=BD=93=E4=BD=9C=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/idormy/sms/forwarder/SettingActivity.java | 1 + .../com/idormy/sms/forwarder/sender/SenderTelegramMsg.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/idormy/sms/forwarder/SettingActivity.java b/app/src/main/java/com/idormy/sms/forwarder/SettingActivity.java index 4da5d17e..3a58691f 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/SettingActivity.java +++ b/app/src/main/java/com/idormy/sms/forwarder/SettingActivity.java @@ -186,6 +186,7 @@ public class SettingActivity extends AppCompatActivity { return; case R.id.bt_insert_time: textSmsTemplate.append("{{接收时间}}"); + return; case R.id.bt_insert_device_name: textSmsTemplate.append("{{设备名称}}"); return; diff --git a/app/src/main/java/com/idormy/sms/forwarder/sender/SenderTelegramMsg.java b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderTelegramMsg.java index 61c8483b..b359f803 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/sender/SenderTelegramMsg.java +++ b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderTelegramMsg.java @@ -34,14 +34,14 @@ public class SenderTelegramMsg { } //特殊处理避免标题重复 - text = text.replaceFirst("^" + from + "(.*)", "").trim(); + text = text.replaceFirst("^" + from + "(.*)", "").replaceAll("#", "井").trim(); String sendUrl = "https://api.telegram.org/bot" + apiToken + "/sendMessage"; Log.d(TAG, "sendUrl:" + sendUrl); Map bodyMap = new HashMap(); bodyMap.put("chat_id", chatId); - bodyMap.put("text", text.trim()); + bodyMap.put("text", text); bodyMap.put("parse_mode", "HTML"); String bodyMsg = JSON.toJSONString(bodyMap); Log.d(TAG, "body:" + bodyMsg);