bot

package
v0.0.0-...-96c3957 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBName    = "bot.db"
	BotBucket = "botdata"
)

Variables

This section is empty.

Functions

func CheckAndWriteCookie

func CheckAndWriteCookie(value string) (bool, error)

CheckAndWriteCookie 检查cookie是否存在,如果不存在则写入数据库

func CloseDatabase

func CloseDatabase() error

CloseDatabase 提供关闭数据库的方法

func GensokyoHandlerClosure

func GensokyoHandlerClosure(c *gin.Context, config config.Config)

GensokyoHandlerClosure 创建一个中间件闭包

func InitializeDB

func InitializeDB()

func IpToNumberWithPort

func IpToNumberWithPort(ip string) (int64, error)

func SendCommandMessages

func SendCommandMessages(command string, config config.Config) error

发送基于命令的消息

func StorePlayerInfo

func StorePlayerInfo(playerUID, steamID, name string) (int64, error)

StorePlayerInfo 存储玩家信息并返回唯一ID

func StoreUserIDAndIP

func StoreUserIDAndIP(userID int64, ip string, uuid string, https bool) error

StoreUserIDAndIP 用于存储用户ID(int64)、IP地址(string)和UUID(string)

Types

type BroadcastRequest

type BroadcastRequest struct {
	Message string `json:"message"`
}

BroadcastRequest 用于封装广播请求的结构体

type KickOrBanRequest

type KickOrBanRequest struct {
	PlayerUID string `json:"playeruid"`
	SteamID   string `json:"steamid"`
	Type      string `json:"type"`
}

type OnebotGroupMessage

type OnebotGroupMessage struct {
	RawMessage      string      `json:"raw_message"`
	MessageID       int         `json:"message_id"`
	GroupID         int64       `json:"group_id"` // Can be either string or int depending on p.Settings.CompleteFields
	MessageType     string      `json:"message_type"`
	PostType        string      `json:"post_type"`
	SelfID          int64       `json:"self_id"` // Can be either string or int
	Sender          Sender      `json:"sender"`
	SubType         string      `json:"sub_type"`
	Time            int64       `json:"time"`
	Avatar          string      `json:"avatar,omitempty"`
	Echo            string      `json:"echo,omitempty"`
	Message         interface{} `json:"message"` // For array format
	MessageSeq      int         `json:"message_seq"`
	Font            int         `json:"font"`
	UserID          int64       `json:"user_id"`
	RealMessageType string      `json:"real_message_type,omitempty"`  //当前信息的真实类型 group group_private guild guild_private
	IsBindedGroupId bool        `json:"is_binded_group_id,omitempty"` //当前群号是否是binded后的
	IsBindedUserId  bool        `json:"is_binded_user_id,omitempty"`  //当前用户号号是否是binded后的
}

群信息事件

type PlayerInfo

type PlayerInfo struct {
	PlayerUID  string `json:"playerUID"`
	SteamID    string `json:"steamID"`
	Name       string `json:"name"`
	Online     bool   `json:"online"`
	LastOnline string `json:"last_online"`
}

func RetrievePlayerInfoByID

func RetrievePlayerInfoByID(id int64) (PlayerInfo, error)

RetrievePlayerInfoByID 通过ID检索玩家信息

type RestartLaterRequest

type RestartLaterRequest struct {
	Seconds string `json:"seconds"`
	Message string `json:"message"`
}

RestartLaterRequest 用于绑定JSON请求体

type Sender

type Sender struct {
	Nickname string `json:"nickname"`
	TinyID   string `json:"tiny_id"`
	UserID   int64  `json:"user_id"`
	Role     string `json:"role,omitempty"`
	Card     string `json:"card,omitempty"`
	Sex      string `json:"sex,omitempty"`
	Age      int32  `json:"age,omitempty"`
	Area     string `json:"area,omitempty"`
	Level    string `json:"level,omitempty"`
	Title    string `json:"title,omitempty"`
}

type UserIPData

type UserIPData struct {
	IP    string `json:"ip"`
	UUID  string `json:"uuid"`
	Https bool   `json:"https"`
}

func RetrieveIPByUserID

func RetrieveIPByUserID(userID int64) (UserIPData, error)

RetrieveIPByUserID 用于通过用户ID(int64)检索IP地址(string)和UUID(string)

Jump to

Keyboard shortcuts

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