Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hellokaton/telegram-bot-api

🤖 telegram bot api by java, help you quickly create a little robot.
https://github.com/hellokaton/telegram-bot-api

java telegram telegram-bot telegram-bot-api

Last synced: 3 months ago
JSON representation

🤖 telegram bot api by java, help you quickly create a little robot.

Awesome Lists containing this project

README

        

# telegram-bot-api

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

[![CI](https://img.shields.io/travis/biezhi/telegram-bot-api.svg)](https://travis-ci.org/biezhi/telegram-bot-api)
[![Maven](https://img.shields.io/maven-central/v/io.github.biezhi/telegram-bot-api.svg)](http://search.maven.org/#search%7Cga%7C1%7C/telegram-bot-api)
[![](https://img.shields.io/badge/license-Apache2-FF0080.svg)](https://github.com/biezhi/telegram-bot-api/blob/master/LICENSE)
[![@biezhi on zhihu](https://img.shields.io/badge/zhihu-%40biezhi-red.svg)](https://www.zhihu.com/people/biezhi)
[![](https://img.shields.io/github/followers/biezhi.svg?style=social&label=Follow%20Me)](https://github.com/biezhi)

## 特性

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

## 快速接入

**下面是Maven坐标**

```java

io.github.biezhi
telegram-bot-api
最新版本

```

## 示例代码

### GetMe

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

### 监听文本指令

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

### 监听贴纸消息

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

### 监听其他消息

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

## 开源协议

[Apache2](https://github.com/biezhi/telegram-bot-api/blob/master/LICENSE)