Struct

package
v0.0.0-...-3e87f45 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MPL-2.0 Imports: 0 Imported by: 0

Documentation

Overview

* @Author: NyanCatda * @Date: 2022-03-09 14:21:18 * @LastEditTime: 2022-03-28 14:38:33 * @LastEditors: NyanCatda * @Description: Line WebHook结构体 * @FilePath: \Momizi\Internal\MessageReceiving\WebHook\Struct\Line.go

* @Author: NyanCatda * @Date: 2022-03-09 14:21:12 * @LastEditTime: 2022-04-03 18:13:29 * @LastEditors: NyanCatda * @Description: Telegram WebHook结构体 * @FilePath: \Momizi\Internal\MessageReceiving\WebHook\Struct\Mirai.go

* @Author: NyanCatda * @Date: 2022-03-09 14:20:49 * @LastEditTime: 2022-03-09 15:21:03 * @LastEditors: NyanCatda * @Description: Telegram WebHook结构体 * @FilePath: \Momizi\Internal\MessageReceiving\WebHookStruct\Telegram.go

* @Author: NyanCatda * @Date: 2022-03-09 15:53:21 * @LastEditTime: 2022-03-12 22:43:42 * @LastEditors: NyanCatda * @Description: WebHook解析结构体 * @FilePath: \Momizi\Internal\MessageReceiving\WebHook\Struct\WebHook.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Line

type Line struct {
	Destination string `json:"destination"` // 消息接收者
	Events      []struct {
		Type    string `json:"type"` // 消息类型,可能类型:"message",
		Message struct {
			Type string `json:"type"` // 消息内容类型,可能类型:"text","image","video","audio","file","sticker"
			ID   string `json:"id"`   // 消息ID(文件需要通过此id获得)

			// 文本消息
			Text string `json:"text"` // 消息内容

			// 文件消息
			FileName string `json:"fileName"` // 文件名
			FileSize int64  `json:"fileSize"` // 文件大小(Byte)

			// 语音消息
			Duration int `json:"duration"` // 语音时长(秒)

			ContentProvider struct {
				Type string `json:"type"` // 消息内容提供者类型,可能类型:"line","external"
			} `json:"contentProvider"`
		} `json:"message"`
		Timestamp int64 `json:"timestamp"` // 消息时间戳
		Source    struct {
			Type    string `json:"type"`    // 消息发送者类型,可能类型:"user","group","room"
			GroupID string `json:"groupId"` // 消息发送群ID
			UserID  string `json:"userId"`  // 消息发送者ID
		} `json:"source"`
		ReplyToken string `json:"replyToken"` // 消息回复Token
		Mode       string `json:"mode"`       // 消息模式,可能模式:"active","standby"
	} `json:"events"`
}

type Mirai

type Mirai struct {
	Type         string `json:"type"` // 聊天类型,可能类型:"FriendMessage","GroupMessage","TempMessage","OtherClientMessage"
	MessageChain []struct {
		Type string `json:"type"` // 消息类型,可能类型:"Source","Quote","At","AtAll","Plain","Image,"Voice","Xml","Json","App","Poke","Forward","File"
		ID   any    `json:"id"`   // 消息ID(文件消息时为文件ID)
		Time int    `json:"time"` // 消息时间戳

		// 文字消息
		Text string `json:"text"` // 文字消息内容

		// 图片消息
		ImageID string `json:"imageId"` // 图片消息ID

		// 语音消息
		VoiceID string `json:"voiceId"` // 语音消息ID
		Length  int    `json:"length"`  // 语音消息长度(ms)

		// 文件消息
		Name string `json:"name"` // 文件名称
		Size int64  `json:"size"` // 文件大小(Byte)

		// 回复消息
		SenderID int `json:"senderId"` // 被引用回复的原消息的发送者的QQ号
		TargetID int `json:"targetId"` // 被引用回复的原消息的发送者的QQ号
		GroupID  int `json:"groupId"`
		Origin   []struct {
			Type string `json:"type"` // 消息类型,可能类型:"Source","Quote","At","AtAll","Plain","Image,"Voice","Xml","Json","App","Poke","Forward"
			ID   int    `json:"id"`   // 消息ID(文件消息下为文件ID)
			Time int    `json:"time"` // 消息时间戳

			// 文字消息
			Text string `json:"text"` // 文字消息内容

			// 图片消息
			ImageID string `json:"imageId"` // 图片消息ID

			// 语音消息
			VoiceID string `json:"voiceId"` // 语音消息ID
			Length  int    `json:"length"`  // 语音消息长度(ms)

			// At消息
			Target  int    `json:"target"`  // 被@的QQ号
			Display string `json:"display"` // At时显示的文字

			URL    string `json:"url"`    //文件链接
			Path   string `json:"path"`   //文件路径
			Base64 string `json:"base64"` //文件base64编码
		} `json:"origin"` // 原消息链

		// At消息
		Target  int    `json:"target"`  // 被@的QQ号
		Display string `json:"display"` // At时显示的文字

		URL    string `json:"url"`    //文件链接
		Path   string `json:"path"`   //文件路径
		Base64 string `json:"base64"` //文件base64编码
	} `json:"messageChain"` // 消息链
	Sender struct {
		ID int `json:"id"` // 发送者QQ号
		// 私聊
		Nickname string `json:"nickname"` // 发送者昵称
		Remark   string `json:"remark"`   // 发送者备注

		// 群聊
		MemberName         string `json:"memberName"`         // 发送者群昵称
		SpecialTitle       string `json:"specialTitle"`       // 发送者群头衔
		Permission         string `json:"permission"`         // 发送者群权限
		JoinTimestamp      int    `json:"joinTimestamp"`      // 发送者入群时间戳
		LastSpeakTimestamp int    `json:"lastSpeakTimestamp"` // 发送者最后发言时间戳
		MuteTimeRemaining  int    `json:"muteTimeRemaining"`  // 发送者禁言剩余时间
		Group              struct {
			ID         int    `json:"id"`         // 群号
			Name       string `json:"name"`       // 群名
			Permission string `json:"permission"` // 群权限,"ADMINISTRATOR","MEMBER"
		} `json:"group"`
	} `json:"sender"`
}

type Telegram

type Telegram struct {
	UpdateID int `json:"update_id"` // 更新ID
	Message  struct {
		MessageID int `json:"message_id"` // 消息ID
		From      struct {
			ID           int    `json:"id"`            // 发送者ID
			IsBot        bool   `json:"is_bot"`        // 发送者是否是机器人
			FirstName    string `json:"first_name"`    // 发送者名
			LastName     string `json:"last_name"`     // 发送者姓
			Username     string `json:"username"`      // 发送者用户名
			LanguageCode string `json:"language_code"` // 发送者使用的语言(zh-hans)
		} `json:"from"`
		Chat struct {
			ID                          int    `json:"id"`                             // 聊天ID
			FirstName                   string `json:"first_name"`                     // 聊天名
			LastName                    string `json:"last_name"`                      // 聊天姓
			Username                    string `json:"username"`                       // 聊天用户名
			Title                       string `json:"title"`                          // 聊天标题
			Type                        string `json:"type"`                           // 聊天类型,可能类型:"private", "group", "supergroup","channel"
			AllMembersAreAdministrators bool   `json:"all_members_are_administrators"` // 是否所有成员都是管理员
		} `json:"chat"`
		Date int `json:"date"` // 消息发送时间(时间戳)

		// 文字消息
		Text string `json:"text"` // 消息内容

		// 图片消息
		Photo []struct {
			FileID       string `json:"file_id"`        // 图片ID
			FileUniqueID string `json:"file_unique_id"` // 图片唯一ID
			FileSize     int    `json:"file_size"`      // 图片大小(Byte)
			Width        int    `json:"width"`          // 图片宽度(Px)
			Height       int    `json:"height"`         // 图片高度(Px)
		} `json:"photo"` // 图片消息组

		// 文件消息
		Document struct {
			FileName string `json:"file_name"` // 文件名
			MimeType string `json:"mime_type"` // 文件类型(MIME type, 如:image/jpeg)
			Thumb    struct {
				FileID       string `json:"file_id"`        // 缩略图ID
				FileUniqueID string `json:"file_unique_id"` // 缩略图唯一ID
				FileSize     int    `json:"file_size"`      // 缩略图大小(Byte)
				Width        int    `json:"width"`          // 缩略图宽度(Px)
				Height       int    `json:"height"`         // 缩略图高度(Px)
			} `json:"thumb"`
			FileID       string `json:"file_id"`        // 文件ID
			FileUniqueID string `json:"file_unique_id"` // 文件唯一ID
			FileSize     int    `json:"file_size"`      // 文件大小(Byte)
		} `json:"document"` // 文件消息

		// 语音消息
		Voice struct {
			Duration     int    `json:"duration"`       // 语音时长(Seconds)
			MimeType     string `json:"mime_type"`      // 语音类型(MIME type, 如:audio/ogg)
			FileID       string `json:"file_id"`        // 语音ID
			FileUniqueID string `json:"file_unique_id"` // 语音唯一ID
			FileSize     int    `json:"file_size"`      // 语音大小(Byte)
		} `json:"voice"` // 语音消息

		// 被回复消息
		ReplyToMessage struct {
			MessageID int `json:"message_id"` // 消息ID
			From      struct {
				ID           int    `json:"id"`            // 发送者ID
				IsBot        bool   `json:"is_bot"`        // 发送者是否是机器人
				FirstName    string `json:"first_name"`    // 发送者名
				LastName     string `json:"last_name"`     // 发送者姓
				Username     string `json:"username"`      // 发送者用户名
				LanguageCode string `json:"language_code"` // 发送者使用的语言(zh-hans)
			} `json:"from"`
			Chat struct {
				ID                          int    `json:"id"`                             // 聊天ID
				FirstName                   string `json:"first_name"`                     // 聊天名
				LastName                    string `json:"last_name"`                      // 聊天姓
				Username                    string `json:"username"`                       // 聊天用户名
				Title                       string `json:"title"`                          // 聊天标题
				Type                        string `json:"type"`                           // 聊天类型,可能类型:"private", "group", "supergroup","channel"
				AllMembersAreAdministrators bool   `json:"all_members_are_administrators"` // 是否所有成员都是管理员
			} `json:"chat"`
			Date int `json:"date"` // 消息发送时间(时间戳)

			// 文字消息
			Text string `json:"text"` // 消息内容

			// 图片消息
			Photo []struct {
				FileID       string `json:"file_id"`        // 图片ID
				FileUniqueID string `json:"file_unique_id"` // 图片唯一ID
				FileSize     int    `json:"file_size"`      // 图片大小(Byte)
				Width        int    `json:"width"`          // 图片宽度(Px)
				Height       int    `json:"height"`         // 图片高度(Px)
			} `json:"photo"` // 图片消息组

			// 文件消息
			Document struct {
				FileName string `json:"file_name"` // 文件名
				MimeType string `json:"mime_type"` // 文件类型(MIME type, 如:image/jpeg)
				Thumb    struct {
					FileID       string `json:"file_id"`        // 缩略图ID
					FileUniqueID string `json:"file_unique_id"` // 缩略图唯一ID
					FileSize     int    `json:"file_size"`      // 缩略图大小(Byte)
					Width        int    `json:"width"`          // 缩略图宽度(Px)
					Height       int    `json:"height"`         // 缩略图高度(Px)
				} `json:"thumb"`
				FileID       string `json:"file_id"`        // 文件ID
				FileUniqueID string `json:"file_unique_id"` // 文件唯一ID
				FileSize     int    `json:"file_size"`      // 文件大小(Byte)
			} `json:"document"` // 文件消息

			// 语音消息
			Voice struct {
				Duration     int    `json:"duration"`       // 语音时长(Seconds)
				MimeType     string `json:"mime_type"`      // 语音类型(MIME type, 如:audio/ogg)
				FileID       string `json:"file_id"`        // 语音ID
				FileUniqueID string `json:"file_unique_id"` // 语音唯一ID
				FileSize     int    `json:"file_size"`      // 语音大小(Byte)
			} `json:"voice"` // 语音消息
		} `json:"reply_to_message"`
	} `json:"message"` // 消息
}

type WebHook

type WebHook struct {
	// 注册TelegramWebHook接收
	Telegram
	// 注册MiraiWebHook接收
	Mirai
	// 注册LineWebHook接收
	Line
}

Jump to

Keyboard shortcuts

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