API Reference
Last updated
This page indexes the three go-bot packages and the methods they share; each package has its own full reference page.
Packages
| Package | Import path | Constructor | Full reference |
|---|---|---|---|
telegram |
github.com/pardnchiu/go-bot/core/telegram |
New(token string, opts ...Option) (*Bot, error) |
Telegram API |
discord |
github.com/pardnchiu/go-bot/core/discord |
New(token string) (*Bot, error) |
Discord API |
line |
github.com/pardnchiu/go-bot/core/line |
New(secret, token, port string, opts ...Option) (*Bot, error) |
LINE API |
Shared shape
Each package declares its own copy of these types and methods; they are not interfaces.
| Symbol | Purpose |
|---|---|
Bot |
Client with lifecycle, handler, and send methods; safe for concurrent use |
Input |
Event passed to the handler; fields differ by platform |
ReplyHandler |
func(ctx context.Context, input Input) string |
Status |
Snapshot returned by Status() |
(*Bot).Start(ctx) error |
Validate credentials and start receiving; no-op when running |
(*Bot).Close() error |
Stop receiving and clear interactive state; no-op when stopped |
(*Bot).Status() Status |
Running flag and bot identity |
(*Bot).Reply(handler) |
Register the handler |
(*Bot).Send(ctx, ...) |
Send text |
(*Bot).Save(ctx, ..., dir) (string, error) |
Download received media; see Saving Media |
Method matrix
| Capability | Telegram | Discord | LINE |
|---|---|---|---|
| Text | Send |
Send |
Send (push) |
| Delete | Delete |
Delete |
— |
| Files | SendFile, SendPhoto |
SendFiles |
— |
| Voice / audio file | SendVoice |
SendVoice |
— |
| Free-text input | SendInput |
SendInput |
— |
| Single select | SendSelect |
SendSelect |
— |
| Multi select | SendMultiSelect |
SendMultiSelect |
— |
| Status message | SendStatus, FinishStatus |
SendStatus, FinishStatus |
— |
| Media download | Save |
Save |
Save |
Removed symbols and old import paths are listed in Removed APIs.