mirror of
https://github.com/pppscn/SmsForwarder
synced 2024-11-15 18:13:57 +00:00
转发telegram时将 # 替换为 井,避免被当作标签
This commit is contained in:
parent
f50cdc56dd
commit
3de9471c2e
@ -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…
Reference in New Issue
Block a user