Documentation ¶
Index ¶
- Constants
- Variables
- func DispatchMessage(m interface{}, o DispatchTo)
- func ExtractLastTextElement(m MessageStringer) (ret *message.TextElement)
- func ExtractMsgSenderUin(m interface{}) (uin int64)
- func IsPrivateMsg(m interface{}) bool
- func RegisterEvent(e EventListener)
- type Bot
- func (b *Bot) ExtractMysPostID(m interface{}) (rest.GameType, int)
- func (b *Bot) Login() (err error)
- func (b *Bot) LookupGroupMessage(groupCode int64, messageID int32) *message.GroupMessage
- func (b *Bot) LookupPrivateMessage(sender int64, messageID int32) *message.PrivateMessage
- func (b *Bot) M() *mys.UserManager
- func (b *Bot) MByMsg(m interface{}) *mys.Clientset
- func (b *Bot) Q() *client.QQClient
- func (b *Bot) RecordMessage(m interface{})
- func (b *Bot) ReplyStr(m interface{}, reply string)
- func (b *Bot) SendOrReplyStrByMsg(m interface{}, toSend string)
- func (b *Bot) SendStrByMsg(m interface{}, toSend string)
- type DispatchTo
- type EventListener
- type LightAppShare
- type MessageStringer
Constants ¶
View Source
const ( Trace miraiLogLevel = "TRACE" Debug miraiLogLevel = "DEBUG" Info miraiLogLevel = "INFO" Warn miraiLogLevel = "WARNING" Error miraiLogLevel = "ERROR" )
Variables ¶
View Source
var ( ErrSessionNotExist = errors.New("session file not exists") ErrReadSessionFile = errors.New("failed to read session file") ErrLoginFailed = errors.New("login failed") )
View Source
var ErrUnknownLogLevel = errors.New("unknown mirai loglevel")
Functions ¶
func DispatchMessage ¶
func DispatchMessage(m interface{}, o DispatchTo)
func ExtractLastTextElement ¶
func ExtractLastTextElement(m MessageStringer) (ret *message.TextElement)
func ExtractMsgSenderUin ¶
func ExtractMsgSenderUin(m interface{}) (uin int64)
func IsPrivateMsg ¶
func IsPrivateMsg(m interface{}) bool
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
bot
func (*Bot) LookupGroupMessage ¶
func (b *Bot) LookupGroupMessage(groupCode int64, messageID int32) *message.GroupMessage
func (*Bot) LookupPrivateMessage ¶
func (b *Bot) LookupPrivateMessage(sender int64, messageID int32) *message.PrivateMessage
func (*Bot) M ¶
func (b *Bot) M() *mys.UserManager
func (*Bot) RecordMessage ¶
func (b *Bot) RecordMessage(m interface{})
func (*Bot) SendOrReplyStrByMsg ¶
func (*Bot) SendStrByMsg ¶
type DispatchTo ¶
type DispatchTo struct { // debug message. // indicate where the message from From string // GroupMessage callback Group func(gm *message.GroupMessage) // PrivateMessage callback Private func(pm *message.PrivateMessage) // Unknown type message callback Default func(m interface{}) }
type LightAppShare ¶
type LightAppShare struct { bool `json:"autosize"` CTime runtime.UnixTimestamp `json:"ctime"` Forward bool `json:"forward"` Token string `json:"token"` Type string `json:"type"` } `json:"config"` AppType int `json:"app_type"` AppID int `json:"appid"` MsgSeq int64 `json:"msg_seq"` Uin int64 `json:"uin"` } `json:"extra"` View map[string]struct { Action string `json:"action"` AndroidPkgName string `json:"android_pkg_name"` AppType int `json:"app_type"` AppID int64 `json:"appid"` Descr string `json:"desc"` JumpURL string `json:"jump_url"` Preview string `json:"preview"` SourceIcon string `json:"source_icon"` SourceURL string `json:"source_url"` Tag string `json:"tag"` Title string `json:"title"` } `json:",inline"` } `json:"meta"` }AutoSize
type MessageStringer ¶
type MessageStringer interface {
ToString() string
}
Click to show internal directories.
Click to hide internal directories.