# 已移除 API

本頁列出 go-bot 已不存在的公開符號、移除的版本，以及替代做法。

## v0.5.0：平台套件移入 core/

`telegram`、`discord`、`line` 三個套件從 module 根目錄移到 `core/`。下列符號在新套件中名稱與簽名都不變（`SendVoice` 除外，見下一節），只有 import path 改變。

| 舊套件（最後存在於 v0.4.3） | 符號 | 狀態 | 替代 |
|---|---|---|---|
| `github.com/pardnchiu/go-bot/telegram` | `Bot`、`ChatStatus`、`FileType`、`Input`、`MessageOption`、`New`、`Option`、`ReplyHandler`、`SendType`、`Status`、`StatusOption`、`WithHTTPClient`、`WithPollTimeout`、`WithSendType`、`WithStatusEmoji`、`WithStatusSendType`；方法 `Close`、`Delete`、`FinishStatus`、`Reply`、`Save`、`Send`、`SendFile`、`SendInput`、`SendMultiSelect`、`SendPhoto`、`SendSelect`、`SendStatus`、`SendVoice`、`Start`、`Status` | 移除於 v0.5.0 | `github.com/pardnchiu/go-bot/core/telegram` |
| `github.com/pardnchiu/go-bot/discord` | `Bot`、`ChannelStatus`、`Input`、`New`、`ReplyHandler`、`Status`、`StatusOption`、`WithStatusEmoji`；方法 `Close`、`Delete`、`FinishStatus`、`Reply`、`Save`、`Send`、`SendFiles`、`SendInput`、`SendMultiSelect`、`SendSelect`、`SendStatus`、`SendVoice`、`Start`、`Status` | 移除於 v0.5.0 | `github.com/pardnchiu/go-bot/core/discord` |
| `github.com/pardnchiu/go-bot/line` | `Bot`、`Input`、`New`、`Option`、`ReplyHandler`、`Status`、`WithPath`；方法 `Close`、`Reply`、`Save`、`Send`、`Start`、`Status` | 移除於 v0.5.0 | `github.com/pardnchiu/go-bot/core/line` |

```go
// 之前（v0.4.x）
import "github.com/pardnchiu/go-bot/telegram"

// 之後（v0.5.0 起）
import "github.com/pardnchiu/go-bot/core/telegram"
```

## v0.5.0：tts 套件與文字版 SendVoice

| 符號 | 狀態 | 最後存在版本 | 替代 |
|---|---|---|---|
| `tts.Get(ctx, apiKey, text string) ([]byte, error)`（Gemini 文字轉語音，經 `ffmpeg` 轉成 OGG/OPUS） | 移除於 v0.5.0 | v0.4.3 | 無公開替代；以自己的 TTS 服務產生 OGG/OPUS 檔 |
| `telegram.SendVoice(ctx, chatID, text, apiKey, caption...)` | 簽名變更，移除於 v0.5.0 | v0.4.3 | `core/telegram` 的 `SendVoice(ctx, chatID, path, caption...)` |
| `discord.SendVoice(ctx, channelID, replyTo, text, apiKey, caption...)` | 簽名變更，移除於 v0.5.0 | v0.4.3 | `core/discord` 的 `SendVoice(ctx, channelID, replyTo, path, caption...)` |

新的 `SendVoice` 簽名以 `caption ...string` 結尾，因此舊呼叫仍可編譯：文字會被當成檔案路徑，API key 會被當成 caption 發出。升級時請逐一人工檢查每個 `SendVoice` 呼叫。

## 相關頁面

- [Telegram 訊息](/zh/telegram-messages)、[Discord 訊息](/zh/discord-messages)
- [v0.5.0 版本紀錄](/released/v0.5.0)
