{"id":58996,"date":"2025-08-16T19:45:28","date_gmt":"2025-08-16T11:45:28","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/58996.html"},"modified":"2025-08-16T19:45:28","modified_gmt":"2025-08-16T11:45:28","slug":"tg%e5%bc%80%e5%8f%91%e7%ae%80%e5%8d%95%e7%9a%84%e5%9b%9e%e5%a3%b0%e6%9c%ba%e5%99%a8%e4%ba%ba","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/58996.html","title":{"rendered":"[TG\u5f00\u53d1]\u7b80\u5355\u7684\u56de\u58f0\u673a\u5668\u4eba"},"content":{"rendered":"<p id=\"kG7mT\" style=\"background-color:transparent\">\u4f60\u597d! \u5982\u679c\u4f60\u60f3\u4e86\u89e3\u5982\u4f55\u5728Java\u4e0a\u7f16\u5199Telegram\u673a\u5668\u4eba&#xff0c;\u4f60\u6765\u5bf9\u5730\u65b9\u4e86!<\/p>\n<p id=\"u218ab8b9\">\n<p id=\"uf05b356d\">\u51c6\u5907\u542f\u52a8<\/p>\n<p id=\"u49717787\">\u673a\u5668\u4ebaAPI\u57fa\u4e8eHTTP\u8bf7\u6c42&#xff0c;\u4f46\u5728\u672c\u4e66\u4e2d\u6211\u5c06\u4f7f\u7528Rubenlagus\u7684Java\u5e93<\/p>\n<p id=\"u782c5d2b\">\n<p id=\"ud934a7ab\">\u5b89\u88c5\u5e93<\/p>\n<p id=\"u5a759b42\">\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u65b9\u6cd5\u5b89\u88c5TelegramBots\u5e93, \u6211\u8fd9\u91cc\u4f7f\u7528Maven<\/p>\n<p>&lt;dependency&gt;<br \/>\n        &lt;groupId&gt;org.telegram&lt;\/groupId&gt;<br \/>\n        &lt;artifactId&gt;telegrambots&lt;\/artifactId&gt;<br \/>\n        &lt;version&gt;Latest&lt;\/version&gt;<br \/>\n&lt;\/dependency&gt;<\/p>\n<p id=\"u29c4100f\">\n<p id=\"uae65fd1a\">\u8ba9\u6211\u4eec\u5f00\u59cb\u7f16\u7801\u5427<\/p>\n<p id=\"ub5c9b7db\">\u5728\u672c\u8282\u8bfe\u4e2d&#xff0c;\u6211\u4eec\u5c06\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u673a\u5668\u4eba&#xff0c;\u5b83\u4f1a\u56de\u663e\u6211\u4eec\u53d1\u9001\u7ed9\u5b83\u7684\u6240\u6709\u5185\u5bb9\u3002\u73b0\u5728&#xff0c;\u6253\u5f00inteliidea&#xff0c;\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\u3002\u4f60\u53ef\u4ee5\u968f\u610f\u7ed9\u5b83\u8d77\u4e2a\u540d\u5b57\u3002<\/p>\n<li id=\"u55e7fc03\">\u73b0\u5728&#xff0c;\u5f53\u4f60\u5728\u8be5\u9879\u76ee\u4e2d\u540e&#xff0c;\u5728src\u76ee\u5f55\u4e0b\u521b\u5efa\u6587\u4ef6MyAmazingBot.java\u548cMain,java\u3002\u6253\u5f00MyAmazingBot.java&#xff0c;\u5e76\u5f00\u59cb\u7f16\u5199\u6211\u4eec\u7684\u5b9e\u9645\u673a\u5668\u4eba!<\/li>\n<li id=\"u420f65fd\">\u8bb0\u4f4f! \u7c7b\u5fc5\u987b\u7ee7\u627fTelegramLongPollingBot\u5e76\u5b9e\u73b0\u5fc5\u8981\u7684\u65b9\u6cd5\u3002<\/li>\n<p>import org.telegram.telegrambots.api.methods.send.SendMessage;<br \/>\nimport org.telegram.telegrambots.api.objects.Update;<br \/>\nimport org.telegram.telegrambots.bots.TelegramLongPollingBot;<br \/>\nimport org.telegram.telegrambots.exceptions.TelegramApiException;<\/p>\n<p>public class MyAmazingBot extends TelegramLongPollingBot {<br \/>\n    &#064;Override<br \/>\n    public void onUpdateReceived(Update update) {<br \/>\n        \/\/ TODO<br \/>\n    }<\/p>\n<p>    &#064;Override<br \/>\n    public String getBotUsername() {<br \/>\n        \/\/ TODO<br \/>\n        return null;<br \/>\n    }<\/p>\n<p>    &#064;Override<br \/>\n    public String getBotToken() {<br \/>\n        \/\/ TODO<br \/>\n        return null;<br \/>\n    }<br \/>\n}<\/p>\n<li id=\"ub1d9701c\">\u6b63\u5982\u60a8\u6240\u7406\u89e3\u7684&#xff0c;<\/li>\n<p id=\"ue601618c\">&#096;getBotUsername()&#039;\u548c&#096;getBotToken ()&#096;\u5fc5\u987b\u8fd4\u56de\u4ece &#064;BotFather\u83b7\u53d6\u7684\u673a\u5668\u4eba\u7684\u7528\u6237\u540d\u548c\u4ee4\u724c\u3002<\/p>\n<p>import org.telegram.telegrambots.api.methods.send.SendMessage;<br \/>\nimport org.telegram.telegrambots.api.objects.Update;<br \/>\nimport org.telegram.telegrambots.bots.TelegramLongPollingBot;<br \/>\nimport org.telegram.telegrambots.exceptions.TelegramApiException;<\/p>\n<p>public class MyAmazingBot extends TelegramLongPollingBot {<br \/>\n    &#064;Override<br \/>\n    public void onUpdateReceived(Update update) {<br \/>\n        \/\/ TODO<br \/>\n    }<\/p>\n<p>    &#064;Override<br \/>\n    public String getBotUsername() {<br \/>\n        \/\/ Return bot username<br \/>\n        \/\/ If bot username is &#064;MyAmazingBot, it must return &#039;MyAmazingBot&#039;<br \/>\n        return &#034;MyAmazingBot&#034;;<br \/>\n    }<\/p>\n<p>    &#064;Override<br \/>\n    public String getBotToken() {<br \/>\n        \/\/ Return bot token from BotFather<br \/>\n        return &#034;12345:qwertyuiopASDGFHKMK&#034;;<br \/>\n    }<br \/>\n}<\/p>\n<li id=\"ucb8fd5bf\">\u73b0\u5728&#xff0c;\u8ba9\u6211\u4eec\u8f6c\u5230\u6211\u4eec\u673a\u5668\u4eba\u7684\u903b\u8f91\u90e8\u5206\u3002<\/li>\n<p id=\"u97d44303\">\u5982\u524d\u6240\u8ff0&#xff0c;\u6211\u4eec\u5e0c\u671b\u5b83\u80fd\u591f\u56de\u590d\u6211\u4eec\u53d1\u9001\u7ed9\u5b83\u7684\u6bcf\u6761\u6587\u672c\u3002&#096;onUpdateReceived(Updateupdate)&#096;\u65b9\u6cd5\u5c31\u662f\u4e3a\u6b64\u800c\u8bbe\u7684\u3002\u5f53\u63a5\u6536\u5230\u4e00\u6761\u66f4\u65b0\u65f6&#xff0c;\u8be5\u65b9\u6cd5\u4f1a\u88ab\u8c03\u7528\u3002<\/p>\n<p>&#064;Override<br \/>\npublic void onUpdateReceived(Update update) {<\/p>\n<p>    \/\/ We check if the update has a message and the message has text<br \/>\n    if (update.hasMessage() &amp;&amp; update.getMessage().hasText()) {<br \/>\n        \/\/ Set variables<br \/>\n        String message_text &#061; update.getMessage().getText();<br \/>\n        long chat_id &#061; update.getMessage().getChatId();<\/p>\n<p>        SendMessage message &#061; new SendMessage() \/\/ Create a message object object<br \/>\n                .setChatId(chat_id)<br \/>\n                .setText(message_text);<br \/>\n        try {<br \/>\n            execute(message); \/\/ Sending our message object to user<br \/>\n        } catch (TelegramApiException e) {<br \/>\n            e.printStackTrace();<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<li id=\"u851e0627\">\u8be5\u5982\u4f55\u8fd0\u884c\u8fd9\u4e2a\u673a\u5668\u4eba\u5462? \u4fdd\u5b58\u8be5\u6587\u4ef6\u5e76\u6253\u5f00Mainjava\u3002\u8fd9\u4e2a\u6587\u4ef6\u5c06\u5b9e\u4f8b\u5316TelegramBotsApi\u5e76\u6ce8\u518c\u6211\u4eec\u7684\u65b0\u673a\u5668\u4eba\u3002<\/li>\n<p>import org.telegram.telegrambots.ApiContextInitializer;<br \/>\nimport org.telegram.telegrambots.TelegramBotsApi;<br \/>\nimport org.telegram.telegrambots.exceptions.TelegramApiException;<br \/>\npublic class Main {<br \/>\n    public static void main(String[] args) {<\/p>\n<p>        \/\/ TODO Initialize Api Context<\/p>\n<p>        \/\/ TODO Instantiate Telegram Bots API<\/p>\n<p>        \/\/ TODO Register our bot<br \/>\n    }<br \/>\n}<\/p>\n<li id=\"u69d32abc\">\u73b0\u5728&#xff0c;\u8ba9\u6211\u4eec\u521d\u59cb\u5316API\u4e0a\u4e0b\u6587<\/li>\n<p>import org.telegram.telegrambots.ApiContextInitializer;<br \/>\nimport org.telegram.telegrambots.TelegramBotsApi;<br \/>\nimport org.telegram.telegrambots.exceptions.TelegramApiException;<br \/>\npublic class Main {<br \/>\n    public static void main(String[] args) {<br \/>\n        \/\/ Initialize Api Context<br \/>\n        ApiContextInitializer.init();<\/p>\n<p>        \/\/ TODO Instantiate Telegram Bots API<\/p>\n<p>        \/\/ TODO Register our bot<br \/>\n    }<br \/>\n}<\/p>\n<li id=\"uc46b2a50\">\u5b9e\u4f8b\u5316Telegram\u673a\u5668\u4ebaAPI:<\/li>\n<p>import org.telegram.telegrambots.ApiContextInitializer;<br \/>\nimport org.telegram.telegrambots.TelegramBotsApi;<br \/>\nimport org.telegram.telegrambots.exceptions.TelegramApiException;<br \/>\npublic class Main {<br \/>\n    public static void main(String[] args) {<br \/>\n        \/\/ Initialize Api Context<br \/>\n        ApiContextInitializer.init();<br \/>\n        \/\/ Instantiate Telegram Bots API<br \/>\n        TelegramBotsApi botsApi &#061; new TelegramBotsApi();<\/p>\n<p>        \/\/ TODO Register our bot<br \/>\n    }<br \/>\n}<\/p>\n<li id=\"u75de43b2\">\u5e76\u6ce8\u518c\u6211\u4eec\u7684\u673a\u5668\u4eba:<\/li>\n<p>import org.telegram.telegrambots.ApiContextInitializer;<br \/>\nimport org.telegram.telegrambots.TelegramBotsApi;<br \/>\nimport org.telegram.telegrambots.exceptions.TelegramApiException;<br \/>\npublic class Main {<br \/>\n    public static void main(String[] args) {<br \/>\n        \/\/ Initialize Api Context<br \/>\n        ApiContextInitializer.init();<\/p>\n<p>        \/\/ Instantiate Telegram Bots API<br \/>\n        TelegramBotsApi botsApi &#061; new TelegramBotsApi();<\/p>\n<p>        \/\/ Register our bot<br \/>\n        try {<br \/>\n            botsApi.registerBot(new MyAmazingBot());<br \/>\n        } catch (TelegramApiException e) {<br \/>\n            e.printStackTrace();<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<li id=\"u9f67f9d0\">\u8fd9\u662f\u6211\u4eec\u7684\u6240\u6709\u6587\u4ef6:<\/li>\n<p>import org.telegram.telegrambots.ApiContextInitializer;<br \/>\nimport org.telegram.telegrambots.TelegramBotsApi;<br \/>\nimport org.telegram.telegrambots.exceptions.TelegramApiException;<br \/>\npublic class Main {<br \/>\n    public static void main(String[] args) {<br \/>\n        \/\/ Initialize Api Context<br \/>\n        ApiContextInitializer.init();<\/p>\n<p>        \/\/ Instantiate Telegram Bots API<br \/>\n        TelegramBotsApi botsApi &#061; new TelegramBotsApi();<\/p>\n<p>        \/\/ Register our bot<br \/>\n        try {<br \/>\n            botsApi.registerBot(new MyAmazingBot());<br \/>\n        } catch (TelegramApiException e) {<br \/>\n            e.printStackTrace();<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>import org.telegram.telegrambots.api.methods.send.SendMessage;<br \/>\n import org.telegram.telegrambots.api.objects.Update;<br \/>\n import org.telegram.telegrambots.bots.TelegramLongPollingBot;<br \/>\n import org.telegram.telegrambots.exceptions.TelegramApiException;<\/p>\n<p> public class MyAmazingBot extends TelegramLongPollingBot {<br \/>\n    &#064;Override<br \/>\n    public void onUpdateReceived(Update update) {<\/p>\n<p>        \/\/ We check if the update has a message and the message has text<br \/>\n        if (update.hasMessage() &amp;&amp; update.getMessage().hasText()) {<br \/>\n            \/\/ Set variables<br \/>\n            String message_text &#061; update.getMessage().getText();<br \/>\n            long chat_id &#061; update.getMessage().getChatId();<\/p>\n<p>            SendMessage message &#061; new SendMessage() \/\/ Create a message object object<br \/>\n                .setChatId(chat_id)<br \/>\n                .setText(message_text);<br \/>\n            try {<br \/>\n                execute(message); \/\/ Sending our message object to user<br \/>\n            } catch (TelegramApiException e) {<br \/>\n                e.printStackTrace();<br \/>\n            }<br \/>\n        }<br \/>\n    }<\/p>\n<p>    &#064;Override<br \/>\n    public String getBotUsername() {<br \/>\n        \/\/ Return bot username<br \/>\n        \/\/ If bot username is &#064;MyAmazingBot, it must return &#039;MyAmazingBot&#039;<br \/>\n        return &#034;MyAmazingBot&#034;;<br \/>\n    }<\/p>\n<p>    &#064;Override<br \/>\n    public String getBotToken() {<br \/>\n        \/\/ Return bot token from BotFather<br \/>\n        return &#034;12345:qwertyuiopASDGFHKMK&#034;;<br \/>\n    }<br \/>\n}<\/p>\n<li id=\"u2a0599dd\">\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u5c06\u9879\u76ee\u6253\u5305\u6210\u53ef\u8fd0\u884c\u7684jar\u6587\u4ef6&#xff0c;\u5e76\u5728\u6211\u4eec\u7684\u8ba1\u7b97\u673a\/\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u5b83!<\/li>\n<p>java -jar MyAmazingBot.jar<\/p>\n<p id=\"u266e915d\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"731\" id=\"u14a57541\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816114512-68a06f48800c8.png\" width=\"1625\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb519\u6b21\uff0c\u70b9\u8d5e13\u6b21\uff0c\u6536\u85cf3\u6b21\u3002\u5982\u524d\u6240\u8ff0\uff0c\u6211\u4eec\u5e0c\u671b\u5b83\u80fd\u591f\u56de\u590d\u6211\u4eec\u53d1\u9001\u7ed9\u5b83\u7684\u6bcf\u6761\u6587\u672c\u3002\u5728\u672c\u8282\u8bfe\u4e2d\uff0c\u6211\u4eec\u5c06\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u673a\u5668\u4eba\uff0c\u5b83\u4f1a\u56de\u663e\u6211\u4eec\u53d1\u9001\u7ed9\u5b83\u7684\u6240\u6709\u5185\u5bb9\u3002\u4f60\u53ef\u4ee5\u968f\u610f\u7ed9\u5b83\u8d77\u4e2a\u540d\u5b57\u3002`getBotUsername()\\&#8217;\u548c`getBotToken ()`\u5fc5\u987b\u8fd4\u56de\u4ece @BotFather\u83b7\u53d6\u7684\u673a\u5668\u4eba\u7684\u7528\u6237\u540d\u548c\u4ee4\u724c\u3002\u673a\u5668\u4ebaAPI\u57fa\u4e8eHTTP\u8bf7\u6c42\uff0c\u4f46\u5728\u672c\u4e66\u4e2d\u6211\u5c06\u4f7f\u7528Rubenlagus\u7684Java\u5e93\u3002\u5982\u679c\u4f60\u60f3\u4e86\u89e3\u5982\u4f55\u5728Java\u4e0a\u7f16\u5199Telegram\u673a\u5668\u4eba\uff0c\u4f60\u6765\u5bf9\u5730\u65b9\u4e86!\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u65b9\u6cd5\u5b89\u88c5TelegramBots\u5e93, \u6211\u8fd9\u91cc\u4f7f\u7528Maven\u3002<\/p>\n","protected":false},"author":2,"featured_media":58995,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,1416,190],"topic":[],"class_list":["post-58996","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-web3","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[TG\u5f00\u53d1]\u7b80\u5355\u7684\u56de\u58f0\u673a\u5668\u4eba - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/58996.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[TG\u5f00\u53d1]\u7b80\u5355\u7684\u56de\u58f0\u673a\u5668\u4eba - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb519\u6b21\uff0c\u70b9\u8d5e13\u6b21\uff0c\u6536\u85cf3\u6b21\u3002\u5982\u524d\u6240\u8ff0\uff0c\u6211\u4eec\u5e0c\u671b\u5b83\u80fd\u591f\u56de\u590d\u6211\u4eec\u53d1\u9001\u7ed9\u5b83\u7684\u6bcf\u6761\u6587\u672c\u3002\u5728\u672c\u8282\u8bfe\u4e2d\uff0c\u6211\u4eec\u5c06\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u673a\u5668\u4eba\uff0c\u5b83\u4f1a\u56de\u663e\u6211\u4eec\u53d1\u9001\u7ed9\u5b83\u7684\u6240\u6709\u5185\u5bb9\u3002\u4f60\u53ef\u4ee5\u968f\u610f\u7ed9\u5b83\u8d77\u4e2a\u540d\u5b57\u3002`getBotUsername()&#039;\u548c`getBotToken ()`\u5fc5\u987b\u8fd4\u56de\u4ece @BotFather\u83b7\u53d6\u7684\u673a\u5668\u4eba\u7684\u7528\u6237\u540d\u548c\u4ee4\u724c\u3002\u673a\u5668\u4ebaAPI\u57fa\u4e8eHTTP\u8bf7\u6c42\uff0c\u4f46\u5728\u672c\u4e66\u4e2d\u6211\u5c06\u4f7f\u7528Rubenlagus\u7684Java\u5e93\u3002\u5982\u679c\u4f60\u60f3\u4e86\u89e3\u5982\u4f55\u5728Java\u4e0a\u7f16\u5199Telegram\u673a\u5668\u4eba\uff0c\u4f60\u6765\u5bf9\u5730\u65b9\u4e86!\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u65b9\u6cd5\u5b89\u88c5TelegramBots\u5e93, \u6211\u8fd9\u91cc\u4f7f\u7528Maven\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/58996.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-16T11:45:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816114512-68a06f48800c8.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/58996.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/58996.html\",\"name\":\"[TG\u5f00\u53d1]\u7b80\u5355\u7684\u56de\u58f0\u673a\u5668\u4eba - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-16T11:45:28+00:00\",\"dateModified\":\"2025-08-16T11:45:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/58996.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/58996.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/58996.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[TG\u5f00\u53d1]\u7b80\u5355\u7684\u56de\u58f0\u673a\u5668\u4eba\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[TG\u5f00\u53d1]\u7b80\u5355\u7684\u56de\u58f0\u673a\u5668\u4eba - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/58996.html","og_locale":"zh_CN","og_type":"article","og_title":"[TG\u5f00\u53d1]\u7b80\u5355\u7684\u56de\u58f0\u673a\u5668\u4eba - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb519\u6b21\uff0c\u70b9\u8d5e13\u6b21\uff0c\u6536\u85cf3\u6b21\u3002\u5982\u524d\u6240\u8ff0\uff0c\u6211\u4eec\u5e0c\u671b\u5b83\u80fd\u591f\u56de\u590d\u6211\u4eec\u53d1\u9001\u7ed9\u5b83\u7684\u6bcf\u6761\u6587\u672c\u3002\u5728\u672c\u8282\u8bfe\u4e2d\uff0c\u6211\u4eec\u5c06\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u673a\u5668\u4eba\uff0c\u5b83\u4f1a\u56de\u663e\u6211\u4eec\u53d1\u9001\u7ed9\u5b83\u7684\u6240\u6709\u5185\u5bb9\u3002\u4f60\u53ef\u4ee5\u968f\u610f\u7ed9\u5b83\u8d77\u4e2a\u540d\u5b57\u3002`getBotUsername()'\u548c`getBotToken ()`\u5fc5\u987b\u8fd4\u56de\u4ece @BotFather\u83b7\u53d6\u7684\u673a\u5668\u4eba\u7684\u7528\u6237\u540d\u548c\u4ee4\u724c\u3002\u673a\u5668\u4ebaAPI\u57fa\u4e8eHTTP\u8bf7\u6c42\uff0c\u4f46\u5728\u672c\u4e66\u4e2d\u6211\u5c06\u4f7f\u7528Rubenlagus\u7684Java\u5e93\u3002\u5982\u679c\u4f60\u60f3\u4e86\u89e3\u5982\u4f55\u5728Java\u4e0a\u7f16\u5199Telegram\u673a\u5668\u4eba\uff0c\u4f60\u6765\u5bf9\u5730\u65b9\u4e86!\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u65b9\u6cd5\u5b89\u88c5TelegramBots\u5e93, \u6211\u8fd9\u91cc\u4f7f\u7528Maven\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/58996.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-16T11:45:28+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816114512-68a06f48800c8.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/58996.html","url":"https:\/\/www.wsisp.com\/helps\/58996.html","name":"[TG\u5f00\u53d1]\u7b80\u5355\u7684\u56de\u58f0\u673a\u5668\u4eba - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-16T11:45:28+00:00","dateModified":"2025-08-16T11:45:28+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/58996.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/58996.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/58996.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"[TG\u5f00\u53d1]\u7b80\u5355\u7684\u56de\u58f0\u673a\u5668\u4eba"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/58996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=58996"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/58996\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/58995"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=58996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=58996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=58996"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=58996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}