From fb437fb329dcab1edbf1ded4a78569dd737cb6f2 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Thu, 4 Nov 2021 09:40:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9ATelegram=E8=BD=AC?= =?UTF-8?q?=E5=8F=91=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89bot?= =?UTF-8?q?=E5=9C=B0=E5=9D=80(=E5=A4=8D=E7=94=A8ApiToken=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=8Chttp=E5=BC=80=E5=A4=B4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../forwarder/sender/SenderTelegramMsg.java | 5 +- app/src/main/res/values-en/strings.xml | 398 +++++++++--------- app/src/main/res/values/strings.xml | 2 +- 3 files changed, 204 insertions(+), 201 deletions(-) diff --git a/app/src/main/java/com/idormy/sms/forwarder/sender/SenderTelegramMsg.java b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderTelegramMsg.java index a9f065b4..930ba668 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/sender/SenderTelegramMsg.java +++ b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderTelegramMsg.java @@ -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(); diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index fb027260..e507aeeb 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -1,199 +1,199 @@ - - SmsForwarder - Forward to DingTalk/WeCom/FeiShu/Email/Bark/ServerChan/Telegram/Webhook, etc - - OK - Cancel - Delete - Test - Confirm - All - Select - Clone Settings - Settings - About - Rule Setting - Sender Setting - Tips: Pull to refresh; Long press to delete one log entry. - Tips: Tap "NEW FORWARDING RULE" to add a new rule; Long press one to delete; Tap an existing one to edit. - Tips: Tap "NEW SENDER" to add a new sender; Long press one to delete; Tap an existing one to edit. - - Version - Check for updates - Auto startup - Show tips - Open source - Synchronize Mirror - QQ Group - 1st:562854376 - 2nd:31330492 - Join 1st Group - Join 2nd Group - Cache - Purge - Checking… - Yo, you are up to date! - Cache purged - No mobile QQ is installed or not supported by recent version! - - Clear Logs - Delete confirmation - Are you sure to delete this log entry? - The log entry has deleted. - Details - Are you sure to clear all forwarding logs? - Pull to refresh. - Release to refresh. - Refreshing… - - Fwd Rule Settings - Delete confirmation - Are you sure to delete this rule entry? - The rule entry has deleted. - Please add a new sender and then choose it. - Please add a sender first. - Select Sender - Rule tester: - New forwarding rule - Test Sim Slot - Test Phone Number - Test Msg Content - Sim Slot - Field - Phone No. - SMS - Multiple - Type - Is - Contain - Not Contain - Start With - End With - Regex Match - Value - - Invalid sender, abort! - Delete confirmation - Are you sure to delete this rule entry? - The rule entry has deleted. - Select sender type - Not supported - DingTalk Bot Settings - Email Settings - Webhook Settings - WeCom Group Bot Settings - WeCom Settings - Bark Settings - ServerChan·Turbo Settings - Telegram Bot Settings - SMS Settings - FeiShu Bot Settings - 19999999999 - Test content @ - 【JD】code 387481, ihelp.jd.com - Test Group Name - Failed to fwd: - Token cannot be empty - Invalid email settings - Bark-server cannot be empty - Neither ApiToken nor ChatId can be empty - SendKey cannot be empty - WebServer cannot be empty - webHook cannot be empty - The specified member cannot be empty or select @all - Phone number cannot be empty - New Sender - Bark Group Name - Bark-Server, e.g. https://bark.bms.ink/XXXXXXXX/ - Bark-Icon (optional), e.g. http://day.app/assets/images/avatar.jpg - Name - Token e.g. the XXXXXX part of https://oapi.dingtalk.com/robot/send?access_token=XXXXXX - Secret (optional) - At Mobiles e.g. 18888888888,19999999999 - SMTP Host - SMTP Port - SSL - Account - Password/Auth Code - Nickname - Send To - Webhook - Secret (optional) - Corp ID - Agent ID - App Secret - Is at all - Specified Member - Tip:Specify members receive messages, member ID list (multiple recipients with \'|\' space, maximum 1000) - WebHook, e.g. https://qyapi.weixin.qq.com/cgixx?key=xxx - ServerChan\'s SendKey - ApiToken - ChatId - Method - WebServer e.g. https://a.b.com/msg?token=xyz - WebParams e.g. payload=%7B%22text%22%3A%22[msg]%22%7D [msg] will be replaced with text message content. \nSupport Json format, for example: {"text":[MSG]}.\n Note: MSG is automatically utF-8 encoded in addition to JSON format - Secret (If empty, sign is not counted) - Sim Slot - Same source - Receive mobile phone numbers separated by, e.g. 15888888888;19999999999 - 仅当无网络时启用 - - Device name - SIM1 Remark - SIM2 Remark - Carrier_Mobile Number - Low power alarm threshold - Value range: 0–100. Left blank or 0 is disabled - Retry interval (seconds) - Retry five times after it fails - Sim slot info attached - Device Name attached - Forward missed calls - Enable custom templates - Custom templates - Tip:Insert labels as needed;Leave blank to default template - Phone - SMS - SIM - Time - Device - Restore initial Setting - Battery Optimization - Unknown Number - Incoming telegram - Your phone does not support this setting - Set successfully! - - v1.0 - https://github.com/pppscn/SmsForwarder - https://gitee.com/pp/SmsForwarder - 0KB - SIM1 - SIM2 - 多重匹配规则示例:\n \n 并且 是 手机号 相等 10086\n 或者 是 手机号 相等 10011\n 并且 是 短信内容 包含 欠费\n \n 以上规则表示:收到短信,并且(手机号是10086 或者 手机号是10010),并且 短信内容 包含 欠费 时转发短信\n 注意:每行开始的空格代表层级,太过复杂的多重规则可能导致内存占用很大! - POST - GET - - Local IP: - Operation instructions: \n1. Please keep the old and new phones in the same WiFi network, and do not turn on isolation \n2.The old mobile phone directly click "send" button, get "server IP" \n3. After filling in "Server IP" for the new mobile phone, click "Receive" button \n [note], the sender and forwarding rules will be completely covered after the new mobile phone receives! - Send - Stop - I\'m the old phone - Receive - I\'m the new phone - Server IP: - . - Please enter a valid IP address - The server is started successfully - The server has been stopped - This mobile phone is the sender and cannot receive files. - If the Wifi network is not connected, the one-click cloning function cannot be used. - Please enter a valid server IP address - Download Failed - Download Success - Currently on a wireless network - Currently on a mobile network - No network at present - Not connected WIFI - Failed to get IP address - + + SmsForwarder + Forward to DingTalk/WeCom/FeiShu/Email/Bark/ServerChan/Telegram/Webhook, etc + + OK + Cancel + Delete + Test + Confirm + All + Select + Clone Settings + Settings + About + Rule Setting + Sender Setting + Tips: Pull to refresh; Long press to delete one log entry. + Tips: Tap "NEW FORWARDING RULE" to add a new rule; Long press one to delete; Tap an existing one to edit. + Tips: Tap "NEW SENDER" to add a new sender; Long press one to delete; Tap an existing one to edit. + + Version + Check for updates + Auto startup + Show tips + Open source + Synchronize Mirror + QQ Group + 1st:562854376 + 2nd:31330492 + Join 1st Group + Join 2nd Group + Cache + Purge + Checking… + Yo, you are up to date! + Cache purged + No mobile QQ is installed or not supported by recent version! + + Clear Logs + Delete confirmation + Are you sure to delete this log entry? + The log entry has deleted. + Details + Are you sure to clear all forwarding logs? + Pull to refresh. + Release to refresh. + Refreshing… + + Fwd Rule Settings + Delete confirmation + Are you sure to delete this rule entry? + The rule entry has deleted. + Please add a new sender and then choose it. + Please add a sender first. + Select Sender + Rule tester: + New forwarding rule + Test Sim Slot + Test Phone Number + Test Msg Content + Sim Slot + Field + Phone No. + SMS + Multiple + Type + Is + Contain + Not Contain + Start With + End With + Regex Match + Value + + Invalid sender, abort! + Delete confirmation + Are you sure to delete this rule entry? + The rule entry has deleted. + Select sender type + Not supported + DingTalk Bot Settings + Email Settings + Webhook Settings + WeCom Group Bot Settings + WeCom Settings + Bark Settings + ServerChan·Turbo Settings + Telegram Bot Settings + SMS Settings + FeiShu Bot Settings + 19999999999 + Test content @ + 【JD】code 387481, ihelp.jd.com + Test Group Name + Failed to fwd: + Token cannot be empty + Invalid email settings + Bark-server cannot be empty + Neither ApiToken nor ChatId can be empty + SendKey cannot be empty + WebServer cannot be empty + webHook cannot be empty + The specified member cannot be empty or select @all + Phone number cannot be empty + New Sender + Bark Group Name + Bark-Server, e.g. https://bark.bms.ink/XXXXXXXX/ + Bark-Icon (optional), e.g. http://day.app/assets/images/avatar.jpg + Name + Token e.g. the XXXXXX part of https://oapi.dingtalk.com/robot/send?access_token=XXXXXX + Secret (optional) + At Mobiles e.g. 18888888888,19999999999 + SMTP Host + SMTP Port + SSL + Account + Password/Auth Code + Nickname + Send To + Webhook + Secret (optional) + Corp ID + Agent ID + App Secret + Is at all + Specified Member + Tip:Specify members receive messages, member ID list (multiple recipients with \'|\' space, maximum 1000) + WebHook, e.g. https://qyapi.weixin.qq.com/cgixx?key=xxx + ServerChan\'s SendKey + ApiToken or Custom address + ChatId + Method + WebServer e.g. https://a.b.com/msg?token=xyz + WebParams e.g. payload=%7B%22text%22%3A%22[msg]%22%7D [msg] will be replaced with text message content. \nSupport Json format, for example: {"text":[MSG]}.\n Note: MSG is automatically utF-8 encoded in addition to JSON format + Secret (If empty, sign is not counted) + Sim Slot + Same source + Receive mobile phone numbers separated by, e.g. 15888888888;19999999999 + 仅当无网络时启用 + + Device name + SIM1 Remark + SIM2 Remark + Carrier_Mobile Number + Low power alarm threshold + Value range: 0–100. Left blank or 0 is disabled + Retry interval (seconds) + Retry five times after it fails + Sim slot info attached + Device Name attached + Forward missed calls + Enable custom templates + Custom templates + Tip:Insert labels as needed;Leave blank to default template + Phone + SMS + SIM + Time + Device + Restore initial Setting + Battery Optimization + Unknown Number + Incoming telegram + Your phone does not support this setting + Set successfully! + + v1.0 + https://github.com/pppscn/SmsForwarder + https://gitee.com/pp/SmsForwarder + 0KB + SIM1 + SIM2 + 多重匹配规则示例:\n \n 并且 是 手机号 相等 10086\n 或者 是 手机号 相等 10011\n 并且 是 短信内容 包含 欠费\n \n 以上规则表示:收到短信,并且(手机号是10086 或者 手机号是10010),并且 短信内容 包含 欠费 时转发短信\n 注意:每行开始的空格代表层级,太过复杂的多重规则可能导致内存占用很大! + POST + GET + + Local IP: + Operation instructions: \n1. Please keep the old and new phones in the same WiFi network, and do not turn on isolation \n2.The old mobile phone directly click "send" button, get "server IP" \n3. After filling in "Server IP" for the new mobile phone, click "Receive" button \n [note], the sender and forwarding rules will be completely covered after the new mobile phone receives! + Send + Stop + I\'m the old phone + Receive + I\'m the new phone + Server IP: + . + Please enter a valid IP address + The server is started successfully + The server has been stopped + This mobile phone is the sender and cannot receive files. + If the Wifi network is not connected, the one-click cloning function cannot be used. + Please enter a valid server IP address + Download Failed + Download Success + Currently on a wireless network + Currently on a mobile network + No network at present + Not connected WIFI + Failed to get IP address + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 76f48bf0..47502a41 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -127,7 +127,7 @@ Tip:指定接收消息的成员,成员ID列表(多个接收者用‘|’分隔,最多支持1000个) 设置WebHook地址:示例:https://qyapi.weixin.qq.com/cgixx?key=xxx 设置Server酱·Turbo版的SendKey - 设置Telegram机器人的ApiToken + 设置Telegram机器人的ApiToken 或 自定义地址 设置被通知人(或群组)的ChatId 请求方式 设置WebServer:例如:https://a.b.com/msg?token=xyz