|
|
@ -54,14 +54,8 @@ public class SenderTelegramMsg extends SenderBaseMsg {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
final String requestUrl = apiToken;
|
|
|
|
final String requestUrl = apiToken;
|
|
|
|
Log.i(TAG, "requestUrl:" + requestUrl);
|
|
|
|
Log.i(TAG, "requestUrl:" + requestUrl);
|
|
|
|
|
|
|
|
String finalText = text;
|
|
|
|
Map bodyMap = new HashMap();
|
|
|
|
Log.i(TAG, "requestMsg:" + finalText);
|
|
|
|
bodyMap.put("chat_id", chatId);
|
|
|
|
|
|
|
|
bodyMap.put("text", text);
|
|
|
|
|
|
|
|
bodyMap.put("parse_mode", "HTML");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final String requestMsg = JSON.toJSONString(bodyMap);
|
|
|
|
|
|
|
|
Log.i(TAG, "requestMsg:" + requestMsg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//代理相关
|
|
|
|
//代理相关
|
|
|
|
final Proxy.Type proxyType = telegramSettingVo.getProxyType();
|
|
|
|
final Proxy.Type proxyType = telegramSettingVo.getProxyType();
|
|
|
@ -107,12 +101,8 @@ public class SenderTelegramMsg extends SenderBaseMsg {
|
|
|
|
.connectionPool(new ConnectionPool(5, 1, TimeUnit.SECONDS)).build();
|
|
|
|
.connectionPool(new ConnectionPool(5, 1, TimeUnit.SECONDS)).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;charset=utf-8"), requestMsg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final Request request = new Request.Builder()
|
|
|
|
final Request request = new Request.Builder()
|
|
|
|
.url(requestUrl)
|
|
|
|
.url(requestUrl + "?chat_id=" + chatId + "&text=" + finalText)
|
|
|
|
.addHeader("Content-Type", "application/json; charset=utf-8")
|
|
|
|
|
|
|
|
.post(requestBody)
|
|
|
|
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
|
|
client.newCall(request).enqueue(new Callback() {
|
|
|
|
client.newCall(request).enqueue(new Callback() {
|
|
|
|