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 메시지 · 미디어 저장