robotic

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 16 Imported by: 1

README

Robotic

机器人

Documentation

Index

Constants

View Source
const (
	ActionHello               = "hello"
	ActionHeartbeat           = "heartbeat"
	ActionNotifyUnknownAction = "notify.unknown.action"

	ActionChatMessage       = "message.chat"
	ActionChatMessageResend = "message.chat.resend"
	ActionGroupMessage      = "message.group"
	ActionMessageFailed     = "message.failed.send"

	ActionNotifyNeedAuth      = "notify.auth"
	ActionNotifyKickOut       = "notify.kickout"
	ActionNotifyNewContact    = "notify.contact"
	ActionNotifyGroup         = "notify.group"
	ActionNotifyAccountLogin  = "notify.login"
	ActionNotifyAccountLogout = "notify.logout"
	ActionNotifyError         = "notify.error"

	ActionAckRequest  = "ack.request"
	ActionAckGroupMsg = "ack.group.msg"
	ActionAckMessage  = "ack.message"
	ActionAckNotify   = "ack.notify"

	ActionApiAuth    = "api.auth"
	ActionApiFailed  = "api.failed"
	ActionApiSuccess = "api.success"

	ActionClientCustom = "message.cli"

	NotifyKickOut = "notify.kickout"
	AckOffline    = "ack.offline"
)

Variables

This section is empty.

Functions

func GetMid

func GetMid(token string) (error, int64)

Types

type BotX

type BotX struct {
	Id string
	// contains filtered or unexported fields
}

func NewBotX

func NewBotX(wsUrl, token string) *BotX

func (*BotX) HandleChatMessage

func (b *BotX) HandleChatMessage(h func(m *messages.GlideMessage, cm *messages.ChatMessage))

func (*BotX) Login

func (b *BotX) Login()

func (BotX) Send

func (b BotX) Send(to string, action messages.Action, data interface{}) error

func (*BotX) Start

func (b *BotX) Start(h func(m *messages.GlideMessage)) error

type MessageHandler

type MessageHandler func(g gate.Gateway, m *messages.GlideMessage)

MessageHandler used to handle the message that robot received.

type MessageInterceptor

type MessageInterceptor interface {
	// contains filtered or unexported methods
}

type Options

type Options struct {
	Ticket string
}

type ProxyRobot

type ProxyRobot struct {
}

func (*ProxyRobot) EnqueueMessage

func (p *ProxyRobot) EnqueueMessage(message *messages.GlideMessage) error

func (*ProxyRobot) Exit

func (p *ProxyRobot) Exit()

func (*ProxyRobot) GetInfo

func (p *ProxyRobot) GetInfo() gate.Info

func (*ProxyRobot) IsRunning

func (p *ProxyRobot) IsRunning() bool

func (*ProxyRobot) Run

func (p *ProxyRobot) Run()

func (*ProxyRobot) SetID

func (p *ProxyRobot) SetID(id gate.ID)

type Response

type Response struct {
	Msg  string
	Code int
	Data struct {
		Mid int64
	}
}

type Robot

type Robot struct {
	Rec chan *messages.GlideMessage
	// contains filtered or unexported fields
}

func NewRobot

func NewRobot(wsUrl string) (*Robot, error)

func (*Robot) BlockSend

func (r *Robot) BlockSend(m *messages.GlideMessage) (error, int64)

func (*Robot) Close

func (r *Robot) Close() error

func (*Robot) Enqueue

func (r *Robot) Enqueue(m *messages.GlideMessage) error

func (*Robot) Run

func (r *Robot) Run() error

type RobotConnection

type RobotConnection struct {
	// contains filtered or unexported fields
}

RobotConnection .

func NewRobotConnection

func NewRobotConnection(g gate.Gateway, handler MessageHandler, opts *Options) (*RobotConnection, error)

func (*RobotConnection) EnqueueMessage

func (r *RobotConnection) EnqueueMessage(m *messages.GlideMessage) error

func (*RobotConnection) Exit

func (r *RobotConnection) Exit()

func (*RobotConnection) GetInfo

func (r *RobotConnection) GetInfo() gate.Info

func (*RobotConnection) IsRunning

func (r *RobotConnection) IsRunning() bool

func (*RobotConnection) Run

func (r *RobotConnection) Run()

func (*RobotConnection) SetID

func (r *RobotConnection) SetID(id gate.ID)

type RobotOptions

type RobotOptions struct {
}

Directories

Path Synopsis
cmd
robot command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL