# LINE API

`github.com/line/line-bot-sdk-go/v8` v8.18.0의 `linebot` 패키지를 기반으로 한 `github.com/pardnchiu/go-bot/core/line`의 모든 exported 심볼입니다.

## 타입

| 심볼 | 정의 | 비고 |
|---|---|---|
| `Bot` | `struct`(비공개 필드) | `New`로 생성. 메서드는 동시 사용에 안전 |
| `Status` | `struct { Running bool; UserID, BasicID, DisplayName string }` | `Status()`가 반환. 식별 정보 필드는 `GetBotInfo`에서 가져옴 |
| `Input` | `struct` | 필드: `SourceType`, `UserID`, `Username`, `GroupID`, `RoomID`, `ReplyToken`, `MessageID`, `MessageType`, `Text`, `FileName`(모두 `string`), `Raw *linebot.Event`. [LINE 설정](/ko/line#input) 참고 |
| `ReplyHandler` | `func(ctx context.Context, input Input) string` | |
| `Option` | `func(*options)` | `New`의 옵션 |

## 생성자와 옵션

| 함수 | 효과 |
|---|---|
| `New(secret, token, port string, opts ...Option) (*Bot, error)` | 인자 중 하나라도 비어 있거나 SDK가 거부하면 오류 |
| `WithPath(path string) Option` | webhook 경로. 기본값 `/linebot/webhook`. 비어 있으면 기본값 유지 |

## 메서드

| 메서드 | 반환값 | 오류와 제한 |
|---|---|---|
| `Start(ctx context.Context)` | `error` | `GetBotInfo` 실패, `net.Listen` 실패 |
| `Close()` | `error` | `http.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 설정](/ko/line) · [LINE 메시지](/ko/line-messages) · [미디어 저장](/ko/media-save)
