Coder Social home page Coder Social logo

telegram-bot-api's Introduction

telegram-bot-api

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

CI Maven LICENSE

特性

  • 快速接入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

Watchers

Kevin.Y avatar

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.