v0.5.0

API Reference

Last updated


This page indexes the three go-bot packages and the methods they share; each package has its own full reference page.

Packages


PackageImport pathConstructorFull reference
telegramgithub.com/pardnchiu/go-bot/core/telegramNew(token string, opts ...Option) (*Bot, error)Telegram API
discordgithub.com/pardnchiu/go-bot/core/discordNew(token string) (*Bot, error)Discord API
linegithub.com/pardnchiu/go-bot/core/lineNew(secret, token, port string, opts ...Option) (*Bot, error)LINE API

Shared shape


Each package declares its own copy of these types and methods; they are not interfaces.
SymbolPurpose
BotClient with lifecycle, handler, and send methods; safe for concurrent use
InputEvent passed to the handler; fields differ by platform
ReplyHandlerfunc(ctx context.Context, input Input) string
StatusSnapshot returned by Status()
(*Bot).Start(ctx) errorValidate credentials and start receiving; no-op when running
(*Bot).Close() errorStop receiving and clear interactive state; no-op when stopped
(*Bot).Status() StatusRunning flag and bot identity
(*Bot).Reply(handler)Register the handler
(*Bot).Send(ctx, ...)Send text
(*Bot).Save(ctx, ..., dir) (string, error)Download received media; see Saving Media

Method matrix


CapabilityTelegramDiscordLINE
TextSendSendSend (push)
DeleteDeleteDelete—
FilesSendFile, SendPhotoSendFiles—
Voice / audio fileSendVoiceSendVoice—
Free-text inputSendInputSendInput—
Single selectSendSelectSendSelect—
Multi selectSendMultiSelectSendMultiSelect—
Status messageSendStatus, FinishStatusSendStatus, FinishStatus—
Media downloadSaveSaveSave

Removed symbols and old import paths are listed in Removed APIs.
中文