# API リファレンス

このページは go-bot の 3 つのパッケージと、それらが共通して持つメソッドの索引です。各パッケージには専用の完全なリファレンスページがあります。

## パッケージ

| パッケージ | Import パス | コンストラクタ | 完全なリファレンス |
|---|---|---|---|
| `telegram` | `github.com/pardnchiu/go-bot/core/telegram` | `New(token string, opts ...Option) (*Bot, error)` | [Telegram API](/ja/api-reference-telegram) |
| `discord` | `github.com/pardnchiu/go-bot/core/discord` | `New(token string) (*Bot, error)` | [Discord API](/ja/api-reference-discord) |
| `line` | `github.com/pardnchiu/go-bot/core/line` | `New(secret, token, port string, opts ...Option) (*Bot, error)` | [LINE API](/ja/api-reference-line) |

## 共通の形

各パッケージはこれらの型とメソッドをそれぞれ独自に宣言しています。interface ではありません。

| シンボル | 用途 |
|---|---|
| `Bot` | ライフサイクル、handler、送信のメソッドを持つクライアント。並行利用しても安全 |
| `Input` | handler に渡されるイベント。フィールドはプラットフォームごとに異なる |
| `ReplyHandler` | `func(ctx context.Context, input Input) string` |
| `Status` | `Status()` が返すスナップショット |
| `(*Bot).Start(ctx) error` | 認証情報を検証して受信を開始する。実行中なら何もしない |
| `(*Bot).Close() error` | 受信を停止してインタラクションの状態を消去する。停止済みなら何もしない |
| `(*Bot).Status() Status` | 実行中フラグと bot の識別情報 |
| `(*Bot).Reply(handler)` | handler を登録する |
| `(*Bot).Send(ctx, ...)` | テキストを送信する |
| `(*Bot).Save(ctx, ..., dir) (string, error)` | 受信したメディアをダウンロードする。[メディアの保存](/ja/media-save) を参照 |

## メソッド対応表

| 機能 | Telegram | Discord | LINE |
|---|---|---|---|
| テキスト | `Send` | `Send` | `Send`（push） |
| 削除 | `Delete` | `Delete` | — |
| ファイル | `SendFile`, `SendPhoto` | `SendFiles` | — |
| ボイス / 音声ファイル | `SendVoice` | `SendVoice` | — |
| 自由入力 | `SendInput` | `SendInput` | — |
| 単一選択 | `SendSelect` | `SendSelect` | — |
| 複数選択 | `SendMultiSelect` | `SendMultiSelect` | — |
| ステータスメッセージ | `SendStatus`, `FinishStatus` | `SendStatus`, `FinishStatus` | — |
| メディアのダウンロード | `Save` | `Save` | `Save` |

削除されたシンボルと古い import パスは [削除された API](/ja/removed-apis) に掲載しています。
