database

package
v0.0.0-...-400fdf6 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 19 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PluginGuard     intent = 1 << iota // 守卫
	PluginBlock                        // 个人屏蔽
	PluginSwitch                       // 开关
	PluginRepeat                       // 复读
	PluginReply                        // 回复
	PluginAdmin                        // 频道管理
	PluginSubscribe                    // 查价订阅
	PluginPrice                        // 查价
	PluginScramble                     // 打乱
	PluginLearn                        // 频道学习
)

Variables

View Source
var Db *sql.DB
View Source
var IntentMap = map[intent]string{
	PluginGuard:     "守卫",
	PluginBlock:     "屏蔽",
	PluginSwitch:    "开关",
	PluginRepeat:    "复读",
	PluginReply:     "回复",
	PluginAdmin:     "频道管理",
	PluginSubscribe: "订阅",
	PluginPrice:     "查价",
	PluginScramble:  "打乱",
	PluginLearn:     "学习",
}
View Source
var Pool *redis.Pool
View Source
var SwitchMap = map[string]intent{
	"守卫":   PluginGuard,
	"屏蔽":   PluginBlock,
	"开关":   PluginSwitch,
	"复读":   PluginRepeat,
	"回复":   PluginReply,
	"频道管理": PluginAdmin,
	"订阅":   PluginSubscribe,
	"查价":   PluginPrice,
	"打乱":   PluginScramble,
	"学习":   PluginLearn,
}

Functions

func GetScramble

func GetScramble(s string) string

func IDBGAN

func IDBGAN(guildId, channelId, item string) (err error)

ItemDeleteByGuildIdAndName

func IntentMean

func IntentMean(intent intent) string

func ItemSave

func ItemSave(guildId, channelId string, brand null.String, item string, price null.String, shipping null.String, updater string, gmtModified null.Time) (err error)

func Judge

func Judge(str string, key JudgeKeys) string

func JudgeIndex

func JudgeIndex(str string, key JudgeKeys) int

func LDBGAA

func LDBGAA(guildId, channelId, ask string) (err error)

func LearnSave

func LearnSave(ask, guildId, channelId, adminId string, answer null.String, gmtModified time.Time, pass bool) (err error)

func PBlockSave

func PBlockSave(guildId, userId, adminId string, ispblock bool, gmtModified time.Time) (err error)

func PluginNameToIntent

func PluginNameToIntent(s string) intent

func SDBGIACI

func SDBGIACI(guildId, channelId string) (err error)

SDBGI SwitchDeleteByGuildIdAndChannelId

func SwitchSave

func SwitchSave(guildId, channelId, adminId string, isCloseOrGuard int64, gmtModified time.Time, isClose bool) (err error)

Types

type CuberPrice

type CuberPrice struct {
	Id          int64       `json:"id"`
	GuildId     string      `json:"guild_id"`
	ChannelId   string      `json:"channel_id"`
	Brand       null.String `json:"brand"`
	Item        string      `json:"item"`
	Price       null.String `json:"price"`
	Shipping    null.String `json:"shipping"`
	Updater     string      `json:"updater"`
	GmtModified null.Time   `json:"gmt_modified"`
}

func GetItem

func GetItem(guildId, channelId string, item string) (cp CuberPrice, err error)

func GetItems

func GetItems(guildId, channelId string, key string) (cps []CuberPrice, err error)

func (*CuberPrice) ItemCreate

func (cp *CuberPrice) ItemCreate() (err error)

func (*CuberPrice) ItemDeleteById

func (cp *CuberPrice) ItemDeleteById() (err error)

func (*CuberPrice) ItemUpdate

func (cp *CuberPrice) ItemUpdate(price null.String, shipping null.String) (err error)

type Info

type Info struct {
	Msg                  string `json:"msg"`
	PageLast             bool   `json:"pageLast"`
	PageEmpty            bool   `json:"pageEmpty"`
	Data                 []PeopleInfo
	TotalPages           int  `json:"totalPages"`
	PageFirst            bool `json:"pageFirst"`
	PageSize             int  `json:"pageSize"`
	PageNumberOfElements int  `json:"pageNumberOfElements"`
	PageNum              int  `json:"pageNum"`
	Retcode              int  `json:"retcode"`
	TotalElements        int  `json:"totalElements"`
}

type JudgeKeys

type JudgeKeys struct {
	Keys []string
}

func JudgeKeysRead

func JudgeKeysRead() (k JudgeKeys, err error)

func (*JudgeKeys) JudgeKeysCreate

func (k *JudgeKeys) JudgeKeysCreate() error

type JudgekeysSync

type JudgekeysSync struct {
	IsTrue        bool
	JudgekeysSync *JudgeKeys
}

func GetJudgeKeys

func GetJudgeKeys() (key JudgekeysSync, err error)

func (*JudgekeysSync) JudgeKeysDelete

func (k *JudgekeysSync) JudgeKeysDelete(dk ...string)

func (*JudgekeysSync) JudgeKeysUpdate

func (k *JudgekeysSync) JudgeKeysUpdate(uk ...string) error

type Learn

type Learn struct {
	Id          int64
	Ask         string
	GuildId     string
	ChannelId   string
	AdminId     string
	Answer      null.String
	GmtModified time.Time
	Pass        bool
}

func (*Learn) LDBGIAAACI

func (learn *Learn) LDBGIAAACI() (err error)

LearnDeleteByGuildIdAndAskAndChannelId

func (*Learn) LearnCreate

func (learn *Learn) LearnCreate() (err error)

func (*Learn) LearnUpdate

func (learn *Learn) LearnUpdate(answer null.String) (err error)

type LearnSync

type LearnSync struct {
	IsTrue    bool `json:"synchronization"`
	LearnSync *Learn
}

func LearnGet

func LearnGet(guildId, channelId, ask string) (learnSync LearnSync, err error)

type PBlock

type PBlock struct {
	Id          int       `json:"id"`
	GuildId     string    `json:"guild_id"`
	UserId      string    `json:"user_id"`
	IsPBlock    bool      `json:"ispblock"`
	AdminId     string    `json:"admin_id"`
	GmtModified time.Time `json:"gmt_modified"`
}

func (*PBlock) PBlockCreate

func (pBlock *PBlock) PBlockCreate() (err error)

func (*PBlock) PBlockUpdate

func (pBlock *PBlock) PBlockUpdate(ispblock bool) (err error)

type PBlockSync

type PBlockSync struct {
	IsTrue     bool `json:"synchronization"`
	PBlockSync *PBlock
}

func PBlockGet

func PBlockGet(guildId, userId string) (pblockSync PBlockSync, err error)

type PeopleInfo

type PeopleInfo struct {
	CountryId string `json:"countryId"`
	Gender    string `json:"gender"`
	Id        string `json:"id"`
	Name      string `json:"name"`
	SubId     int    `json:"subId"`
}

type PeopleRankInfo

type PeopleRankInfo struct {
	Best          int    `json:"best"`
	ContinentRank int    `json:"continentRank"`
	CountryRank   string `json:"countryRank"`
	EventId       string `json:"eventId"`
	PersonId      string `json:"personId"`
	WorldRank     int    `json:"worldRank"`
}

type RankInfo

type RankInfo struct {
	Msg                  string `json:"msg"`
	PageLast             bool   `json:"pageLast"`
	PageEmpty            bool   `json:"pageEmpty"`
	Data                 []PeopleRankInfo
	TotalPages           int  `json:"totalPages"`
	PageFirst            bool `json:"pageFirst"`
	PageSize             int  `json:"pageSize"`
	PageNumberOfElements int  `json:"pageNumberOfElements"`
	PageNum              int  `json:"pageNum"`
	Retcode              int  `json:"retcode"`
	TotalElements        int  `json:"totalElements"`
}

type Scramble

type Scramble struct {
	Instruction string
	ShortName   string
	ShowName    string
}

func Tnoodle

func Tnoodle(scramble string) (s Scramble)

type Switch

type Switch struct {
	Id             int       `json:"id"`
	GuildId        string    `json:"guild_id"`
	ChannelId      string    `json:"channel_id"`
	IsCloseOrGuard int64     `json:"is_close_or_guard"`
	AdminId        string    `json:"admin_id"`
	GmtModified    time.Time `json:"gmt_modified"`
}

func (*Switch) SwitchCreate

func (bot_switch *Switch) SwitchCreate() (err error)

func (*Switch) SwitchUpdate

func (bot_switch *Switch) SwitchUpdate(isCloseOrGuard int64, adminId string, gmtModified time.Time) (err error)

type SwitchSync

type SwitchSync struct {
	IsTrue       bool `json:"synchronization"`
	PluginSwitch *Switch
}

func SGBGIACI

func SGBGIACI(guildId, channelId string) (bot_switch_sync SwitchSync, err error)

SGBGI SwitchGetByGuildIdAndChannelId

Jump to

Keyboard shortcuts

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