Documentation
¶
Index ¶
- type LINEChannel
- func (c *LINEChannel) Send(ctx context.Context, msg bus.OutboundMessage) ([]string, error)
- func (c *LINEChannel) SendMedia(ctx context.Context, msg bus.OutboundMediaMessage) ([]string, error)
- func (c *LINEChannel) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (c *LINEChannel) Start(ctx context.Context) error
- func (c *LINEChannel) StartTyping(ctx context.Context, chatID string) (func(), error)
- func (c *LINEChannel) Stop(ctx context.Context) error
- func (c *LINEChannel) VoiceCapabilities() channels.VoiceCapabilities
- func (c *LINEChannel) WebhookPath() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LINEChannel ¶
type LINEChannel struct {
*channels.BaseChannel
// contains filtered or unexported fields
}
LINEChannel implements the Channel interface for LINE Official Account using the LINE Messaging API with HTTP webhook for receiving messages and the official LINE Bot SDK for sending messages.
func NewLINEChannel ¶
func NewLINEChannel( bc *config.Channel, cfg *config.LINESettings, messageBus *bus.MessageBus, ) (*LINEChannel, error)
NewLINEChannel creates a new LINE channel instance.
func (*LINEChannel) Send ¶
func (c *LINEChannel) Send(ctx context.Context, msg bus.OutboundMessage) ([]string, error)
Send sends a message to LINE. It first tries the Reply API (free) using a cached reply token, then falls back to the Push API.
func (*LINEChannel) SendMedia ¶
func (c *LINEChannel) SendMedia(ctx context.Context, msg bus.OutboundMediaMessage) ([]string, error)
SendMedia implements the channels.MediaSender interface. LINE requires media to be accessible via public URL; since we only have local files, we fall back to sending a text message with the filename/caption. For full support, an external file hosting service would be needed.
func (*LINEChannel) ServeHTTP ¶
func (c *LINEChannel) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler for the shared HTTP server.
func (*LINEChannel) Start ¶
func (c *LINEChannel) Start(ctx context.Context) error
Start initializes the LINE channel.
func (*LINEChannel) StartTyping ¶
func (c *LINEChannel) StartTyping(ctx context.Context, chatID string) (func(), error)
StartTyping implements channels.TypingCapable using LINE's loading animation.
NOTE: The LINE loading animation API only works for 1:1 chats. Group/room chat IDs (starting with "C" or "R") are detected automatically; for these, a no-op stop function is returned without calling the API.
func (*LINEChannel) Stop ¶
func (c *LINEChannel) Stop(ctx context.Context) error
Stop gracefully stops the LINE channel.
func (*LINEChannel) VoiceCapabilities ¶
func (c *LINEChannel) VoiceCapabilities() channels.VoiceCapabilities
VoiceCapabilities returns the voice capabilities of the channel.
func (*LINEChannel) WebhookPath ¶
func (c *LINEChannel) WebhookPath() string
WebhookPath returns the path for registering on the shared HTTP server.