v0.5.1

LINE API

最終更新


github.com/line/line-bot-sdk-go/v8 v8.18.0 の linebot パッケージを土台にした github.com/pardnchiu/go-bot/core/line のすべての exported シンボルです。

型


シンボル定義備考
Botstruct(非公開フィールド)New で作成する。メソッドは並行利用しても安全
Statusstruct { Running bool; UserID, BasicID, DisplayName string }Status() が返す。識別情報のフィールドは GetBotInfo から取得
Inputstructフィールド: SourceType、UserID、Username、GroupID、RoomID、ReplyToken、MessageID、MessageType、Text、FileName(すべて string)、Raw *linebot.Event。LINE の設定 を参照
ReplyHandlerfunc(ctx context.Context, input Input) string
Optionfunc(*options)New のオプション

コンストラクタとオプション


関数効果
New(secret, token, port string, opts ...Option) (*Bot, error)いずれかの引数が空の場合、または SDK が拒否した場合にエラー
WithPath(path string) Optionwebhook のパス。デフォルトは /linebot/webhook。空ならデフォルトのまま

メソッド


メソッド戻り値エラーと制限
Start(ctx context.Context)errorGetBotInfo の失敗、net.Listen の失敗
Close()errorhttp.Server.Shutdown の失敗(タイムアウト 5 秒)
Status()Status
Reply(handler ReplyHandler)—以前の handler を置き換える
Send(ctx, to, text string)(*linebot.BasicResponse, error)空の to、API のエラー
Save(ctx, messageID, dir string)(string, error)空の引数、50 MiB を超えるコンテンツ、API のエラー、ファイルシステムのエラー

関連ページ


LINE の設定 · LINE メッセージ · メディアの保存