LINE API
Last updated
Every exported symbol of
github.com/pardnchiu/go-bot/core/line, built on the linebot package of github.com/line/line-bot-sdk-go/v8 v8.18.0.Types
| Symbol | Definition | Notes |
|---|---|---|
Bot | struct (unexported fields) | Create with New; methods are safe for concurrent use |
Status | struct { Running bool; UserID, BasicID, DisplayName string } | Returned by Status(); identity fields come from GetBotInfo |
Input | struct | Fields: SourceType, UserID, Username, GroupID, RoomID, ReplyToken, MessageID, MessageType, Text, FileName (all string), Raw *linebot.Event. See LINE Setup |
ReplyHandler | func(ctx context.Context, input Input) string | |
Option | func(*options) | Options for New |
Constructor and options
| Function | Effect |
|---|---|
New(secret, token, port string, opts ...Option) (*Bot, error) | Error when any argument is empty or the SDK rejects them |
WithPath(path string) Option | Webhook path; default /linebot/webhook; empty keeps the default |
Methods
| Method | Returns | Errors and limits |
|---|---|---|
Start(ctx context.Context) | error | GetBotInfo failure, net.Listen failure |
Close() | error | http.Server.Shutdown failure (5-second timeout) |
Status() | Status | |
Reply(handler ReplyHandler) | — | Replaces the previous handler |
Send(ctx, to, text string) | (*linebot.BasicResponse, error) | Empty to, API error |
Save(ctx, messageID, dir string) | (string, error) | Empty args, content over 50 MiB, API error, file system errors |
Related pages
LINE Setup · LINE Messages · Saving Media