Documentation ¶
Index ¶
- Constants
- func CheckAndWriteCookie(value string) (bool, error)
- func CloseDatabase() error
- func GensokyoHandlerClosure(c *gin.Context, config config.Config)
- func InitializeDB()
- func IpToNumberWithPort(ip string) (int64, error)
- func SendCommandMessages(command string, config config.Config) error
- func StorePlayerInfo(playerUID, steamID, name string) (int64, error)
- func StoreUserIDAndIP(userID int64, ip string, uuid string, https bool) error
- type BroadcastRequest
- type KickOrBanRequest
- type OnebotGroupMessage
- type PlayerInfo
- type RestartLaterRequest
- type Sender
- type UserIPData
Constants ¶
View Source
const ( DBName = "bot.db" BotBucket = "botdata" )
Variables ¶
This section is empty.
Functions ¶
func CheckAndWriteCookie ¶
CheckAndWriteCookie 检查cookie是否存在,如果不存在则写入数据库
func GensokyoHandlerClosure ¶
GensokyoHandlerClosure 创建一个中间件闭包
func InitializeDB ¶
func InitializeDB()
func IpToNumberWithPort ¶
func SendCommandMessages ¶
发送基于命令的消息
func StorePlayerInfo ¶
StorePlayerInfo 存储玩家信息并返回唯一ID
Types ¶
type BroadcastRequest ¶
type BroadcastRequest struct {
Message string `json:"message"`
}
BroadcastRequest 用于封装广播请求的结构体
type KickOrBanRequest ¶
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 ¶
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)
Click to show internal directories.
Click to hide internal directories.