API 參考
本頁列出各 package 入口。涉及網路操作的 SDK call 都使用 context.Context。
共通生命週期模式
| Package | Constructor | 生命週期 | Handler |
|---|---|---|---|
telegram |
New(token, opts...) |
Start(ctx)、Close()、Status() |
Reply(handler) |
discord |
New(token) |
Start(ctx)、Close()、Status() |
Reply(handler) |
line |
New(secret, token, port, opts...) |
Start(ctx)、Close()、Status() |
Reply(handler) |
Telegram
提供 Send、Delete、SendFile、SendPhoto、SendVoice、SendInput、SendSelect、SendMultiSelect、SendStatus、FinishStatus 與 Save。Options 包含 WithHTTPClient、WithPollTimeout、WithSendType、WithStatusEmoji 與 WithStatusSendType。
Discord
提供 Send、Delete、SendFiles、SendVoice、SendInput、SendSelect、SendMultiSelect、SendStatus、FinishStatus 與 Save。WithStatusEmoji 用於設定 status reaction。
LINE 與 TTS
LINE 除生命週期與 Reply 外,提供 Send 與 Save;WithPath 設定 webhook route。TTS 提供 Get(ctx, apiKey, text) ([]byte, error)。