handlers

package
v0.0.0-...-e4931e2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppID string
View Source
var BotID string

Functions

func ConvertMapToJSONString

func ConvertMapToJSONString(m map[string]interface{}) (string, error)

将map转化为json string

func ConvertToInt64

func ConvertToInt64(value interface{}) (int64, error)

ConvertToInt64 尝试将 interface{} 类型的值转换为 int64 类型

func ConvertToSegmentedMessage

func ConvertToSegmentedMessage(data interface{}) []map[string]interface{}

将收到的data.content转换为message segment todo,群场景不支持受图片,频道场景的图片可以拼一下

func CreateSendGroupMsgAction

func CreateSendGroupMsgAction(originalMsg callapi.ActionMessage) *callapi.ActionMessage

func GenerateReplyMessage

func GenerateReplyMessage(foundItems map[string][]string, messageText string) (*discordgo.MessageSend, error)

GenerateReplyMessage 创建一个discordgo兼容的消息,支持多个图片

func GetGroupList

func GetGroupList(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func GetGroupMemberInfo

func GetGroupMemberInfo(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

getGroupMemberInfo是处理获取群成员信息的函数

func GetGroupMemberList

func GetGroupMemberList(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func GetGuildChannelList

func GetGuildChannelList(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func GetGuildList

func GetGuildList(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func GetGuildServiceProfile

func GetGuildServiceProfile(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func GetLoginInfo

func GetLoginInfo(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func GetMessageIDByUseridAndGroupid

func GetMessageIDByUseridAndGroupid(appID string, userID interface{}, groupID interface{}) string

通过user_id获取messageID

func GetMessageIDByUseridOrGroupid

func GetMessageIDByUseridOrGroupid(appID string, userID interface{}) string

通过user_id获取messageID

func GetMessageTypeByGroupid

func GetMessageTypeByGroupid(appID string, GroupID interface{}) string

通过group_id获取类型

func GetMessageTypeByGroupidV2

func GetMessageTypeByGroupidV2(GroupID interface{}) string

通过group_id获取类型

func GetMessageTypeByUserid

func GetMessageTypeByUserid(appID string, userID interface{}) string

通过user_id获取类型

func GetMessageTypeByUseridV2

func GetMessageTypeByUseridV2(userID interface{}) string

通过user_id获取类型

func GetOnlineClients

func GetOnlineClients(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func GetStatus

func GetStatus(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func GetVersionInfo

func GetVersionInfo(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func HandleGetFriendList

func HandleGetFriendList(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func HandleGetGroupInfo

func HandleGetGroupInfo(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func HandleSendGroupForwardMsg

func HandleSendGroupForwardMsg(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func HandleSendGroupMsg

func HandleSendGroupMsg(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func HandleSendGuildChannelMsg

func HandleSendGuildChannelMsg(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func HandleSendGuildChannelPrivateMsg

func HandleSendGuildChannelPrivateMsg(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage, optionalGuildID *string, optionalChannelID *string) (string, error)

处理频道私信 最后2个指针参数可空 代表使用userid倒推

func HandleSendMsg

func HandleSendMsg(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func HandleSendPrivateMsg

func HandleSendPrivateMsg(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func Handle_quick_operation

func Handle_quick_operation(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func MarkThisMessageAsRead

func MarkThisMessageAsRead(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

func RevertTransformedText

func RevertTransformedText(data interface{}, msgtype string, s *discordgo.Session, vgid int64) string

处理at和其他定形文到onebotv11格式(cq码)

func SendMessage

func SendMessage(messageText string, data interface{}, messageType string, s *discordgo.Session) error

SendMessage 发送消息根据不同的类型

func SendResponse

func SendResponse(client callapi.Client, err error, message *callapi.ActionMessage) (string, error)

发送成功回执 todo 返回可互转的messageid

func SetGroupBan

func SetGroupBan(client callapi.Client, s *discordgo.Session, message callapi.ActionMessage) (string, error)

Types

type APIOutput

type APIOutput struct {
	Data    []FriendData `json:"data"`
	Message string       `json:"message"`
	RetCode int          `json:"retcode"`
	Status  string       `json:"status"`
	Echo    interface{}  `json:"echo"`
}

type FriendData

type FriendData struct {
	Nickname string `json:"nickname"`
	Remark   string `json:"remark"`
	UserID   string `json:"user_id"`
}

type GetStatusResponse

type GetStatusResponse struct {
	Data    StatusData  `json:"data"`
	Message string      `json:"message"`
	RetCode int         `json:"retcode"`
	Status  string      `json:"status"`
	Echo    interface{} `json:"echo"`
}

type Group

type Group struct {
	GroupCreateTime int32  `json:"group_create_time"`
	GroupID         int64  `json:"group_id"`
	GroupLevel      int32  `json:"group_level"`
	GroupMemo       string `json:"group_memo"`
	GroupName       string `json:"group_name"`
	MaxMemberCount  int32  `json:"max_member_count"`
	MemberCount     int32  `json:"member_count"`
}

type GroupInfo

type GroupInfo struct {
	GroupID         int64  `json:"group_id"`
	GroupName       string `json:"group_name"`
	GroupMemo       string `json:"group_memo"`
	GroupCreateTime int32  `json:"group_create_time"`
	GroupLevel      int32  `json:"group_level"`
	MemberCount     int32  `json:"member_count"`
	MaxMemberCount  int32  `json:"max_member_count"`
}

type GroupList

type GroupList struct {
	Data    []Group     `json:"data"`
	Message string      `json:"message"`
	RetCode int         `json:"retcode"`
	Status  string      `json:"status"`
	Echo    interface{} `json:"echo"`
}

type Guild

type Guild struct {
	JoinedAt    string `json:"joined_at"`
	ID          string `json:"id"`
	OwnerID     string `json:"owner_id"`
	Description string `json:"description"`
	Name        string `json:"name"`
	MaxMembers  string `json:"max_members"`
	MemberCount string `json:"member_count"`
}

type GuildChannelListResponse

type GuildChannelListResponse struct {
	Data    []interface{} `json:"data"`
	Message string        `json:"message"`
	RetCode int           `json:"retcode"`
	Status  string        `json:"status"`
	Echo    interface{}   `json:"echo"`
}

type GuildData

type GuildData struct {
	GuildID        string `json:"guild_id"`
	GuildName      string `json:"guild_name"`
	GuildDisplayID string `json:"guild_display_id"`
}

type GuildListResponse

type GuildListResponse struct {
	Data    []GuildData `json:"data"`
	Message string      `json:"message"`
	RetCode int         `json:"retcode"`
	Status  string      `json:"status"`
	Echo    interface{} `json:"echo"`
}

type GuildServiceProfileData

type GuildServiceProfileData struct {
	Nickname string `json:"nickname"`
	TinyID   int64  `json:"tiny_id"`
}

type GuildServiceProfileResponse

type GuildServiceProfileResponse struct {
	Data    GuildServiceProfileData `json:"data"`
	Message string                  `json:"message"`
	RetCode int                     `json:"retcode"`
	Status  string                  `json:"status"`
	Echo    interface{}             `json:"echo"`
}

type LoginInfoData

type LoginInfoData struct {
	Nickname string `json:"nickname"`
	UserID   string `json:"user_id"` // Assuming UserID is a string type based on the pseudocode
}

type LoginInfoResponse

type LoginInfoResponse struct {
	Data    LoginInfoData `json:"data"`
	Message string        `json:"message"`
	RetCode int           `json:"retcode"`
	Status  string        `json:"status"`
	Echo    interface{}   `json:"echo"`
}

type MarkThisMessageAsReadAPIResponse

type MarkThisMessageAsReadAPIResponse struct {
	Status  string       `json:"status"`
	Data    gjson.Result `json:"data"`
	Msg     string       `json:"msg"`
	Wording string       `json:"wording"`
	RetCode int64        `json:"retcode"`
	Echo    interface{}  `json:"echo"`
}

type MemberInfo

type MemberInfo struct {
	UserID          int64  `json:"user_id"`
	GroupID         int64  `json:"group_id"`
	Nickname        string `json:"nickname"`
	Card            string `json:"card"`
	Sex             string `json:"sex"`
	Age             int32  `json:"age"`
	Area            string `json:"area"`
	JoinTime        int32  `json:"join_time"`
	LastSentTime    int32  `json:"last_sent_time"`
	Level           string `json:"level"`
	Role            string `json:"role"`
	Unfriendly      bool   `json:"unfriendly"`
	Title           string `json:"title"`
	TitleExpireTime int64  `json:"title_expire_time"`
	CardChangeable  bool   `json:"card_changeable"`
	ShutUpTimestamp int64  `json:"shut_up_timestamp"`
}

成员信息的结构定义

type MemberList

type MemberList struct {
	GroupID         int64  `json:"group_id"`
	UserID          int64  `json:"user_id"`
	Nickname        string `json:"nickname"`
	Card            string `json:"card"`
	Sex             string `json:"sex"`
	Age             int32  `json:"age"`
	Area            string `json:"area"`
	JoinTime        int32  `json:"join_time"`
	LastSentTime    int32  `json:"last_sent_time"`
	Level           string `json:"level"`
	Role            string `json:"role"`
	Unfriendly      bool   `json:"unfriendly"`
	Title           string `json:"title"`
	TitleExpireTime int64  `json:"title_expire_time"`
	CardChangeable  bool   `json:"card_changeable"`
	ShutUpTimestamp int64  `json:"shut_up_timestamp"`
}

Member Onebot 群成员

type OnebotGroupInfo

type OnebotGroupInfo struct {
	Data    GroupInfo   `json:"data"`
	Message string      `json:"message"`
	RetCode int         `json:"retcode"`
	Status  string      `json:"status"`
	Echo    interface{} `json:"echo"`
}

func ConvertGuildToGroupInfo

func ConvertGuildToGroupInfo(guild *discordgo.Guild, GroupId string, message callapi.ActionMessage) *OnebotGroupInfo

type OnlineClientsData

type OnlineClientsData struct {
	Clients []interface{} `json:"clients"` // It seems you want an empty array for clients
	TinyID  int64         `json:"tiny_id"`
}

type OnlineClientsResponse

type OnlineClientsResponse struct {
	Data    OnlineClientsData `json:"data"`
	Message string            `json:"message"`
	RetCode int               `json:"retcode"`
	Status  string            `json:"status"`
	Echo    interface{}       `json:"echo"`
}

type Response

type Response struct {
	Retcode int          `json:"retcode"`
	Status  string       `json:"status"`
	Data    []MemberList `json:"data"`
	Echo    interface{}  `json:"echo"` // 使用 interface{} 类型以容纳整数或文本
}

type ServerResponse

type ServerResponse struct {
	Data struct {
		MessageID int `json:"message_id"`
	} `json:"data"`
	Message string      `json:"message"`
	RetCode int         `json:"retcode"`
	Status  string      `json:"status"`
	Echo    interface{} `json:"echo"`
}

定义响应结构体

type Statistics

type Statistics struct {
	PacketReceived  uint64 `json:"packet_received"`
	PacketSent      uint64 `json:"packet_sent"`
	PacketLost      uint32 `json:"packet_lost"`
	MessageReceived uint64 `json:"message_received"`
	MessageSent     uint64 `json:"message_sent"`
	DisconnectTimes uint32 `json:"disconnect_times"`
	LostTimes       uint32 `json:"lost_times"`
	LastMessageTime int64  `json:"last_message_time"`
}

type StatusData

type StatusData struct {
	AppInitialized bool       `json:"app_initialized"`
	AppEnabled     bool       `json:"app_enabled"`
	PluginsGood    bool       `json:"plugins_good"`
	AppGood        bool       `json:"app_good"`
	Online         bool       `json:"online"`
	Good           bool       `json:"good"`
	Stat           Statistics `json:"stat"`
}

type VersionData

type VersionData struct {
	AppFullName              string `json:"app_full_name"`
	AppName                  string `json:"app_name"`
	AppVersion               string `json:"app_version"`
	CoolQDirectory           string `json:"coolq_directory"`
	CoolQEdition             string `json:"coolq_edition"`
	GoCQHTTP                 bool   `json:"go-cqhttp"`
	PluginBuildConfiguration string `json:"plugin_build_configuration"`
	PluginBuildNumber        int    `json:"plugin_build_number"`
	PluginVersion            string `json:"plugin_version"`
	ProtocolName             int    `json:"protocol_name"`
	ProtocolVersion          string `json:"protocol_version"`
	RuntimeOS                string `json:"runtime_os"`
	RuntimeVersion           string `json:"runtime_version"`
	Version                  string `json:"version"`
}

type VersionInfoResponse

type VersionInfoResponse struct {
	Data    VersionData `json:"data"`
	Message string      `json:"message"`
	RetCode int         `json:"retcode"`
	Status  string      `json:"status"`
	Echo    interface{} `json:"echo"`
}

Jump to

Keyboard shortcuts

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