types

package
v0.0.0-...-531763a Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Check = "<:eodCheck:765333533362225222>"
View Source
const MaxComboLength = 21
View Source
const NoCheck = "❌"
View Source
const RedCircle = "🔴"

Consts

Variables

View Source
var PostfixSql = map[string]string{
	"id":        "id::text",
	"image":     "image",
	"color":     "color::text",
	"creator":   "creator",
	"createdon": "createdon",
	"commenter": "commenter",
	"colorer":   "colorer",
	"imager":    "imager",
	"treesize":  "treesize::text",
}
View Source
var Postfixes = []sevcord.Choice{
	sevcord.NewChoice("ID", "id"),
	sevcord.NewChoice("Image", "image"),
	sevcord.NewChoice("Color", "color"),
	sevcord.NewChoice("Creator", "creator"),
	sevcord.NewChoice("Created On", "createdon"),
	sevcord.NewChoice("Commenter", "commenter"),
	sevcord.NewChoice("Colorer", "colorer"),
	sevcord.NewChoice("Imager", "imager"),
	sevcord.NewChoice("Tree Size", "treesize"),
}
View Source
var SortSql = map[string]string{
	"id":        "id",
	"name":      "name",
	"creator":   "creator",
	"createdon": "createdon",
	"treesize":  "treesize DESC",
	"length":    "LENGTH(name) DESC",
}
View Source
var Sorts = []sevcord.Choice{
	sevcord.NewChoice("ID", "id"),
	sevcord.NewChoice("Name", "name"),
	sevcord.NewChoice("Creator", "creator"),
	sevcord.NewChoice("Created On", "createdon"),
	sevcord.NewChoice("Tree Size", "treesize"),
	sevcord.NewChoice("Length", "length"),
}

Discord util

Functions

func GetPostfixVal

func GetPostfixVal(val, postfix string) string

Types

type Category

type Category struct {
	Guild   string `db:"guild"`
	Name    string `db:"name"`
	Comment string `db:"comment"`
	Image   string `db:"image"`
	Color   int    `db:"color"`

	Commenter string `db:"commenter"`
	Imager    string `db:"imager"`
	Colorer   string `db:"colorer"`

	Elements pq.Int32Array `db:"elements"`
}

type CombCache

type CombCache struct {
	Elements []int
	Result   int
}

type Config

type Config struct {
	Guild         string         `db:"guild"`
	VotingChannel string         `db:"voting"`
	NewsChannel   string         `db:"news"`
	VoteCnt       int            `db:"votecnt"`
	PollCnt       int            `db:"pollcnt"`
	PlayChannels  pq.StringArray `db:"play"`
}

Guilds

type Element

type Element struct {
	ID        int       `db:"id"`
	Guild     string    `db:"guild"`
	Name      string    `db:"name"`
	Image     string    `db:"image"`
	Color     int       `db:"color"`
	Comment   string    `db:"comment"`
	Creator   string    `db:"creator"`
	CreatedOn time.Time `db:"createdon"`

	Commenter string `db:"commenter"`
	Colorer   string `db:"colorer"`
	Imager    string `db:"imager"`

	Parents  pq.Int32Array `db:"parents"`
	TreeSize int           `db:"treesize"`
}

Element

func Starters

func Starters(guild string) []Element

type PgData

type PgData map[string]interface{}

func (PgData) Scan

func (p PgData) Scan(v interface{}) error

func (PgData) Value

func (p PgData) Value() (driver.Value, error)

type Poll

type Poll struct {
	// Filed in by CreatePoll
	Guild     string    `db:"guild"`
	Message   string    `db:"message"`
	Channel   string    `db:"channel"`
	Creator   string    `db:"creator"`
	CreatedOn time.Time `db:"createdon"`

	Upvotes   int `db:"upvotes"`
	Downvotes int `db:"downvotes"`

	// Required
	Kind PollKind `db:"kind"`
	Data PgData   `db:"data"`
}

type PollKind

type PollKind string

Polls

const (
	PollKindCombo        PollKind = "combo"
	PollKindCategorize   PollKind = "cat"
	PollKindUncategorize PollKind = "rmcat"
	PollKindComment      PollKind = "comment" // Use "Sign", not "Comment"
	PollKindCatComment   PollKind = "catcomment"
	PollKindQueryComment PollKind = "querycomment"
	PollKindImage        PollKind = "img"
	PollKindCatImage     PollKind = "catimg"
	PollKindQueryImage   PollKind = "queryimg"
	PollKindColor        PollKind = "color"
	PollKindCatColor     PollKind = "catcolor"
	PollKindQueryColor   PollKind = "querycolor"
	PollKindQuery        PollKind = "query"
	PollKindDelQuery     PollKind = "delquery"
)

type Query

type Query struct {
	Guild   string `db:"guild"`
	Name    string `db:"name"`
	Creator string `db:"creator"`

	Image   string `db:"image"`
	Color   int    `db:"color"`
	Comment string `db:"comment"`

	Imager    string `db:"imager"`
	Colorer   string `db:"colorer"`
	Commenter string `db:"commenter"`

	CreatedOn time.Time `db:"createdon"`

	Kind QueryKind `db:"kind"`
	Data PgData    `db:"data"`

	// After calc
	Elements []int
}

type QueryKind

type QueryKind string
const (
	QueryKindElement    QueryKind = "element"
	QueryKindCategory   QueryKind = "cat"
	QueryKindProducts   QueryKind = "products"
	QueryKindParents    QueryKind = "parents"
	QueryKindInventory  QueryKind = "inv"
	QueryKindElements   QueryKind = "elements"
	QueryKindRegex      QueryKind = "regex"
	QueryKindComparison QueryKind = "compare"
	QueryKindOperation  QueryKind = "op"
)

type Resp

type Resp struct {
	Ok bool
	// contains filtered or unexported fields
}

Resp

func Error

func Error(err error) Resp

func Fail

func Fail(message string) Resp

func Ok

func Ok() Resp

func (*Resp) Error

func (r *Resp) Error() error

func (*Resp) Response

func (r *Resp) Response() sevcord.MessageSend

type ServerMem

type ServerMem struct {
	sync.RWMutex
	CombCache map[string]CombCache // map[userid]CombCache

	CommandStatsTODO    map[string]int
	CommandStatsTODOCnt int
}

Jump to

Keyboard shortcuts

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