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

pull/67/head
pppscn 3 years ago
parent a28fd0d4d8
commit 7dd83c38be

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

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

Loading…
Cancel
Save