Git Product home page Git Product logo

telegram-bot-api's Introduction

telegram-bot-api

这是一个 Telegram 的机器人库,能够帮你快速搭建一个机器人程序运行。

CI Maven @biezhi on zhihu

特性

  • 快速接入API
  • 内置多种实现
  • 支持代理,不怕被墙
  • 依赖更少,简单最好
  • 异步调用,效率更高
  • 灵活配置,满足自定义需求

快速接入

下面是Maven坐标

<dependency>
    <groupId>io.github.biezhi</groupId>
    <artifactId>telegram-bot-api</artifactId>
    <version>最新版本</version>
</dependency>

示例代码

GetMe

TelegramBot bot = new TelegramBot(TOKEN);
System.out.println(bot.getMe());

监听文本指令

TelegramBot bot = new TelegramBot(TOKEN);
bot.onCmd("/help", message -> {
    log.info("收到消息: {}", message);
    bot.text(message, "/echo\r\n/me\r\n/hi");
}).await();

监听贴纸消息

TelegramBot bot = new TelegramBot(TOKEN);
bot.onSticker(message -> {
    log.info("收到贴图: {}", message);
}).await();

监听其他消息

TelegramBot bot = new TelegramBot(TOKEN);
bot.onOther(message -> {
    log.info("收到消息: {}", message);
}).await();

开源协议

Apache2

telegram-bot-api's People

Contributors

hellokaton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

telegram-bot-api's Issues

Error on import

I user jre8. My windows is 32 bit & I can not update my jre.
When I imported the project I have had some problem in TelegramBot..java:

  • the method builder is undefined -> Options.builder() line 43
  • log can not be resolved ->log.info() line 125
  • The method getResult() is undefined for the type GetUpdatesResponse -> response.getResult() line 228
  • syntax error -> .map(Update::getMessage) line 239
  • Syntax error on token "-", -- expected -> forEach(message -> othersMapping.accept(message)) line 258

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.