v0.5.0

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


SymbolDefinitionNotes
Botstruct (unexported fields)Create with New; methods are safe for concurrent use
Statusstruct { Running bool; UserID, BasicID, DisplayName string }Returned by Status(); identity fields come from GetBotInfo
InputstructFields: SourceType, UserID, Username, GroupID, RoomID, ReplyToken, MessageID, MessageType, Text, FileName (all string), Raw *linebot.Event. See LINE Setup
ReplyHandlerfunc(ctx context.Context, input Input) string
Optionfunc(*options)Options for New

Constructor and options


FunctionEffect
New(secret, token, port string, opts ...Option) (*Bot, error)Error when any argument is empty or the SDK rejects them
WithPath(path string) OptionWebhook path; default /linebot/webhook; empty keeps the default

Methods


MethodReturnsErrors and limits
Start(ctx context.Context)errorGetBotInfo failure, net.Listen failure
Close()errorhttp.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


LINE Setup · LINE Messages · Saving Media
中文