转发telegram时将 # 替换为 井,避免被当作标签

This commit is contained in:
pppscn 2021-05-18 09:23:14 +08:00
parent f50cdc56dd
commit 3de9471c2e
2 changed files with 3 additions and 2 deletions

View File

@ -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;

View File

@ -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);