Documentation
¶
Index ¶
- Constants
- Variables
- func CommonLogin() error
- func GenRandomDevice()
- func Init()
- func InitBot(account int64, password string)
- func InitWithDeviceJSONContent(deviceJSONContent []byte)
- func InitWithOption(option InitOption) error
- func Login() error
- func LoginWithOption(option LoginOption) error
- func QrcodeLogin() error
- func RefreshList()
- func RegisterModule(instance Module)
- func SaveToken()
- func StartService()
- func Stop()
- func UseDevice(device []byte) error
- func UseProtocol(p protocol)
- type Bot
- type InitOption
- type LoginMethod
- type LoginOption
- type Module
- type ModuleID
- type ModuleInfo
Constants ¶
View Source
const ( LoginMethodToken = "token" LoginMethodQRCode = "qrcode" LoginMethodCommon = "common" )
View Source
const ( AndroidPhone = protocol(client.AndroidPhone) IPad = protocol(client.IPad) AndroidWatch = protocol(client.AndroidWatch) MacOS = protocol(client.MacOS) )
Variables ¶
View Source
var ErrSMSRequestError = errors.New("sms request error")
ErrSMSRequestError SMS请求出错
Functions ¶
func InitWithDeviceJSONContent ¶
func InitWithDeviceJSONContent(deviceJSONContent []byte)
func InitWithOption ¶
func InitWithOption(option InitOption) error
func LoginWithOption ¶
func LoginWithOption(option LoginOption) error
Types ¶
type InitOption ¶
type LoginMethod ¶
type LoginMethod string
type LoginOption ¶
type LoginOption struct { LoginMethod LoginMethod Token []byte //if not nil, try with most priority UseTokenWhenUnmatchedUin bool }
type Module ¶
type Module interface { MiraiGoModule() ModuleInfo // Init 初始化 // 待所有 Module 初始化完成后 // 进行服务注册 Serve Init() // PostInit 第二次初始化 // 调用该函数时,所有 Module 都已完成第一段初始化过程 // 方便进行跨Module调用 PostInit() // Serve 向Bot注册服务函数 // 结束后调用 Start Serve(bot *Bot) // Start 启用Module // 此处调用为 // “` go // go Start() // “` // 结束后进行登录 Start(bot *Bot) // Stop 应用结束时对所有 Module 进行通知 // 在此进行资源回收 Stop(bot *Bot, wg *sync.WaitGroup) }
Module MiraiGo 中的模块 用于进行模块化设计
type ModuleInfo ¶
ModuleInfo 模块信息
func GetModule ¶
func GetModule(name string) (ModuleInfo, error)
GetModule - 获取一个已注册的 Module 的 ModuleInfo
func (ModuleInfo) String ¶
func (mi ModuleInfo) String() string
Click to show internal directories.
Click to hide internal directories.