events

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddQuickEmoticonData

type AddQuickEmoticonData struct {
	VillaId    uint64 `json:"villa_id"`
	RoomId     uint64 `json:"room_id"`
	Uid        uint64 `json:"uid"`
	EmoticonId uint16 `json:"emoticon_id"`
	Emoticon   string `json:"emoticon"`
	MsgUid     string `json:"msg_uid"`
	BotMsgId   string `json:"bot_msg_id"`
	IsCancel   bool   `json:"is_cancel"`
}

type AuditCallbackData

type AuditCallbackData struct {
	AuditId     string `json:"audit_id"`
	BotTplId    string `json:"bot_tpl_id"`
	VillaId     uint64 `json:"villa_id"`
	RoomId      uint64 `json:"room_id"`
	UserId      uint64 `json:"user_id"`
	PassThrough string `json:"pass_through"`
	AuditResult uint   `json:"audit_result"`
}

type BotListenerAddQuickEmoticon

type BotListenerAddQuickEmoticon func(data EventAddQuickEmoticon)

type BotListenerAuditCallback

type BotListenerAuditCallback func(data EventAuditCallback)

type BotListenerCreateRobot

type BotListenerCreateRobot func(data EventCreateRobot)

type BotListenerDeleteRobot

type BotListenerDeleteRobot func(data EventDeleteRobot)

type BotListenerJoinVilla

type BotListenerJoinVilla func(data EventJoinVilla)

listeners for each event

type BotListenerRawRequest added in v0.4.0

type BotListenerRawRequest func(c *gin.Context)

raw request listener

type BotListenerSendMessage

type BotListenerSendMessage func(data EventSendMessage)

type CreateRobotData

type CreateRobotData struct {
	VillaId uint64 `json:"villa_id"`
}

type DeleteRobotData

type DeleteRobotData struct {
	VillaId uint64 `json:"villa_id"`
}

type Event

type Event struct {
	Event struct {
		EventBase
		ExtendData struct {
			EventData struct {
				JoinVilla        JoinVillaData        `json:"JoinVilla,omitempty"`
				SendMessage      SendMessageData      `json:"SendMessage,omitempty"`
				CreateRobot      CreateRobotData      `json:"CreateRobot,omitempty"`
				DeleteRobot      DeleteRobotData      `json:"DeleteRobot,omitempty"`
				AddQuickEmoticon AddQuickEmoticonData `json:"AddQuickEmoticon,omitempty"`
				AuditCallback    AuditCallbackData    `json:"AuditCallback,omitempty"`
			} `json:"EventData"`
		} `json:"extend_data"`
	} `json:"event"`
	Type string `json:"type,omitempty"` // for sdk reverse proxy packet handling
	Sign string `json:"sign,omitempty"` // for sdk reverse proxy packet handling
}

type EventAddQuickEmoticon

type EventAddQuickEmoticon struct {
	EventBase
	Data AddQuickEmoticonData
}

func Event2EventAddQuickEmoticon

func Event2EventAddQuickEmoticon(event Event) EventAddQuickEmoticon

type EventAuditCallback

type EventAuditCallback struct {
	EventBase
	Data AuditCallbackData
}

func Event2EventAuditCallback

func Event2EventAuditCallback(event Event) EventAuditCallback

type EventBase

type EventBase struct {
	Robot     Robot     `json:"robot"`
	Type      EventType `json:"type"`
	CreatedAt uint64    `json:"created_at"`
	Id        string    `json:"id"`
	SendAt    uint64    `json:"send_at"`
}

type EventCreateRobot

type EventCreateRobot struct {
	EventBase
	Data CreateRobotData
}

func Event2EventCreateRobot

func Event2EventCreateRobot(event Event) EventCreateRobot

type EventDeleteRobot

type EventDeleteRobot struct {
	EventBase
	Data DeleteRobotData
}

func Event2EventDeleteRobot

func Event2EventDeleteRobot(event Event) EventDeleteRobot

type EventJoinVilla

type EventJoinVilla struct {
	EventBase
	Data JoinVillaData
}

func Event2EventJoinVilla

func Event2EventJoinVilla(event Event) EventJoinVilla

type EventSendMessage

type EventSendMessage struct {
	EventBase
	Data SendMessageData
	// contains filtered or unexported fields
}

func Event2EventSendMessage

func Event2EventSendMessage(event Event, api *apis.ApiBase) EventSendMessage

func (*EventSendMessage) GetContent

func (e *EventSendMessage) GetContent(is_treat bool) string

获取消息内容,is_treat为true时,如果消息内容以/开头,则去掉/

func (*EventSendMessage) Reply

在相应的房间回复消息 i.e. wrapper for api.SendMessage 使用内嵌格式发送消息,并自动处理内部Entity(<@xxx>为艾特机器人或用户,<@everyone>为艾特全体,<#xxx>为跳转房间,<$xxx>为跳转连接) 艾特用户会自动获取用户昵称,跳转房间会自动获取房间名称;艾特机器人会显示文字“机器人”,艾特全体会显示“全体成员”,跳转连接会显示链接自身 使用\< 和 \> 可转义 < 和 >,不会被解析为Entity

func (*EventSendMessage) ReplyCustomize added in v0.3.0

在相应的房间回复消息 i.e. wrapper for api.SendMessageCustomize 使用models.NewMsg创建消息,然后使用models.SetText等方法加入内容,最后使用此函数发送

type EventType

type EventType uint8

--------- enum EventType start ---------

const (
	JoinVilla        EventType = 1
	SendMessage      EventType = 2
	CreateRobot      EventType = 3
	DeleteRobot      EventType = 4
	AddQuickEmoticon EventType = 5
	AuditCallback    EventType = 6
)

type JoinVillaData

type JoinVillaData struct {
	JoinUid          uint64 `json:"join_uid"`
	JoinUserNickname string `json:"join_user_nickname"`
	JoinAt           uint64 `json:"join_at"`
	VillaId          uint64 `json:"villa_id"`
}

type Robot

type Robot struct {
	Template struct {
		Id       string `json:"id"`
		Name     string `json:"name"`
		Desc     string `json:"desc"`
		Icon     string `json:"icon"`
		Commands []struct {
			Name string `json:"name"`
			Desc string `json:"desc"`
		} `json:"commands"`
	} `json:"template"`
	VillaId uint64 `json:"villa_id"`
}

type SendMessageData

type SendMessageData struct {
	ContentRaw string `json:"content"`
	Content    struct {
		Trace struct {
			VisualRoomVersion string `json:"visual_room_version"`
			AppVersion        string `json:"app_version"`
			ActionType        uint8  `json:"action_type"`
			BotMsgId          string `json:"bot_msg_id"`
			Client            string `json:"client"`
			Env               string `json:"env"`
			RongSdkVersion    string `json:"rong_sdk_version"`
		} `json:"trace"`
		MentionedInfo struct {
			MentionedContent string   `json:"mentioned_content"`
			UserIdList       []string `json:"user_id_list"`
			Type             uint8    `json:"type"`
		} `json:"mentioned_info"`
		User struct {
			PortraitUri string `json:"portrait_uri"`
			Extra       struct {
				MemberRoles struct {
					Name          string `json:"name"`
					Color         string `json:"color"`
					WebColor      string `json:"web_color"`
					RoleFontColor string `json:"role_font_color"`
					RoleBgColor   string `json:"role_bg_color"`
				} `json:"member_roles"`
				State interface{} `json:"state"`
			} `json:"extra"`
			Name     string `json:"name"`
			Alias    string `json:"alias"`
			Id       string `json:"id"`
			Portrait string `json:"portrait"`
		} `json:"user"`
		Content struct {
			Images []struct {
				Url  string `json:"url"`
				Size struct {
					Width  uint64 `json:"width"`
					Height uint64 `json:"height"`
				} `json:"size"`
				FileSize uint64 `json:"file_size"`
			} `json:"images"`
			Entities []struct {
				Offset uint8 `json:"offset"`
				Length uint8 `json:"length"`
				Entity struct {
					Type  string `json:"type"`
					BotId string `json:"bot_id"`
				} `json:"entity"`
			} `json:"entities"`
			Text string `json:"text"`
		}
	}
	FromUserId uint64 `json:"from_user_id"`
	SendAt     uint64 `json:"send_at"`
	ObjectName uint64 `json:"object_name"`
	RoomId     uint64 `json:"room_id"`
	Nickname   string `json:"nickname"`
	MsgUid     string `json:"msg_uid"`
	BotMsgId   string `json:"bot_msg_id"`
	VillaId    uint64 `json:"villa_id"`
}

Jump to

Keyboard shortcuts

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