<p align="center">
<strong>BUILD BOTS THAT FIT EVERY CHAT PLATFORM</strong>
</p>

<p align="center">
<a href="https://pkg.go.dev/github.com/pardnchiu/go-bot"><img src="https://img.shields.io/badge/GO-REFERENCE-blue?include_prereleases&style=for-the-badge" alt="Go Reference"></a>
<a href="https://github.com/pardnchiu/go-bot/releases"><img src="https://img.shields.io/github/v/tag/pardnchiu/go-bot?include_prereleases&style=for-the-badge" alt="Release"></a>
<a href="https://github.com/pardnchiu/go-bot/blob/master/LICENSE"><img src="https://img.shields.io/github/license/pardnchiu/go-bot?include_prereleases&style=for-the-badge" alt="License"></a>
<a href="https://app.codecov.io/github/pardnchiu/go-bot/tree/master"><img src="https://img.shields.io/codecov/c/github/pardnchiu/go-bot/master?include_prereleases&style=for-the-badge" alt="Coverage"></a>
</p>

***

> Telegram、Discord、LINE のアダプター、単一の reply handler、ネイティブなインタラクションを備えた Go 製マルチプラットフォームチャットボットライブラリ

> [!NOTE]
> go-bot は主に [Agenvoy](https://agenvoy.com/ja/)（Go で書かれた、24 時間 365 日動き続けるローカル AI エージェント）のために作られています。Agenvoy がユーザーとやり取りするために使う Telegram、Discord、LINE のチャネル層を提供します。

## 目次

- [機能](#機能)
- [アーキテクチャ](#アーキテクチャ)
- [ライセンス](#ライセンス)
- [作者](#作者)

## 機能

> `go get github.com/pardnchiu/go-bot`

- **同期的な reply 契約** — プラットフォームごとに `Reply` handler を 1 つ登録します。空でない戻り値はトリガーとなったメッセージへの返信として送られ、handler の panic はライブラリが recover するため接続は切れません。
- **プラットフォームネイティブのトランスポート** — Telegram の long polling と Discord Gateway はアウトバウンド接続のため NAT の内側でも動作し、LINE は署名を検証する webhook サーバーを内蔵しています。いずれも同じ `New`/`Start`/`Close` ライフサイクルで扱えます。
- **インタラクションは 1 つの handler に戻る** — Telegram の inline keyboard と ForceReply、Discord の select menu とボタンからモーダルを開くフローは、ユーザーの選択と回答を `Input` として同じ handler に届けます。
- **デバウンスされた「考え中」ステータス** — `SendStatus` は元のメッセージにリアクションを付け、1 つのステータスメッセージを最大で 1 秒に 1 回だけ編集します。`FinishStatus` はリアクションとメッセージの両方を消去し、プラットフォームのレート制限内に収めます。
- **上限付きのメディア保存** — 添付ファイルのダウンロードにはプラットフォームごとに 20/25/50 MiB の上限があり、UUID のファイル名でアトミックに書き込みます。アップロードはディスクから直接ストリーミングします。

## アーキテクチャ

```mermaid
graph TB
    App[Application] --> TG[core/telegram]
    App --> DC[core/discord]
    App --> LN[core/line]
    TG -->|long polling| TelegramAPI[Telegram Bot API]
    DC -->|WebSocket Gateway| DiscordAPI[Discord API]
    LineAPI[LINE Platform] -->|HTTPS webhook| LN
    TG --> Handler[ReplyHandler]
    DC --> Handler
    LN --> Handler
```

## ライセンス

このプロジェクトは [MIT LICENSE](https://github.com/pardnchiu/go-bot/blob/master/LICENSE) の下でライセンスされています。

## 作者

アイデアがあれば気軽に [issue を作成](https://github.com/pardnchiu/go-bot/issues/new)してください。

<a href="https://github.com/pardnchiu/go-bot/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=pardnchiu/go-bot&cache_bust=2026-10-06" alt="go-bot contributors" />
</a>

***

©️ 2026 [邱敬幃 Pardn Chiu](https://www.linkedin.com/in/pardnchiu)
