优化:Telegram转发支持自定义bot地址(复用ApiToken字段,http开头)

This commit is contained in:
pppscn 2021-11-04 09:40:47 +08:00
parent 519ca3db5a
commit fb437fb329
3 changed files with 204 additions and 201 deletions

View File

@ -40,7 +40,10 @@ public class SenderTelegramMsg extends SenderBaseMsg {
//特殊处理避免标题重复
text = text.replaceAll("#", "").trim();
final String requestUrl = "https://api.telegram.org/bot" + apiToken + "/sendMessage";
if (!apiToken.startsWith("http")) {
apiToken = "https://api.telegram.org/bot" + apiToken + "/sendMessage";
}
final String requestUrl = apiToken;
Log.i(TAG, "requestUrl:" + requestUrl);
Map bodyMap = new HashMap();

View File

@ -127,7 +127,7 @@
<string name="specified_member_tips">TipSpecify members receive messages, member ID list (multiple recipients with \'|\' space, maximum 1000)</string>
<string name="QYWXGroupRobotWebHook">WebHook, e.g. https://qyapi.weixin.qq.com/cgixx?key=xxx</string>
<string name="ServerChanSendKey">ServerChan\'s SendKey</string>
<string name="TelegramApiToken">ApiToken</string>
<string name="TelegramApiToken">ApiToken or Custom address</string>
<string name="TelegramChatId">ChatId</string>
<string name="WebNotifyMethod">Method</string>
<string name="WebNotifyWebServer">WebServer e.g. https://a.b.com/msg?token=xyz</string>

View File

@ -127,7 +127,7 @@
<string name="specified_member_tips">Tip指定接收消息的成员成员ID列表多个接收者用|分隔最多支持1000个</string>
<string name="QYWXGroupRobotWebHook">设置WebHook地址:示例https://qyapi.weixin.qq.com/cgixx?key=xxx</string>
<string name="ServerChanSendKey">设置Server酱·Turbo版的SendKey</string>
<string name="TelegramApiToken">设置Telegram机器人的ApiToken</string>
<string name="TelegramApiToken">设置Telegram机器人的ApiToken 或 自定义地址</string>
<string name="TelegramChatId">设置被通知人(或群组)的ChatId</string>
<string name="WebNotifyMethod">请求方式</string>
<string name="WebNotifyWebServer">设置WebServer例如https://a.b.com/msg?token=xyz</string>