models

package
v0.0.0-...-8101777 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2022 License: AGPL-3.0-or-later Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRule

func CreateRule(
	db *gorm.DB,
	rule *Rule,
) error

func DeleteRule

func DeleteRule(
	db *gorm.DB,
	rule *Rule,
) error

func UpdateRule

func UpdateRule(
	db *gorm.DB,
	id uint,
	rule *Rule,
) error

Types

type Env

type Env struct {
	Rule      *Rule
	Event     *events.Event
	State     *state.State
	Redis     *redis.Client
	Handler   HandlerInterface
	GuildID   string
	ChannelID []string
	UserID    []string
	Messages  []*EnvMessage
	Tokens    map[string]string
}

func (*Env) Marshal

func (e *Env) Marshal() ([]byte, error)

func (*Env) Unmarshal

func (e *Env) Unmarshal(data []byte) error

type EnvMessage

type EnvMessage struct {
	ID        string
	ChannelID string
	Bot       bool
}

func NewEnvMessage

func NewEnvMessage(message *discordgo.Message) *EnvMessage

type HandlerInterface

type HandlerInterface interface {
	Handle(event *events.Event) (process bool)
}

type LogEntry

type LogEntry struct {
	gorm.Model
	GuildID      string
	Rule         Rule
	RuleID       uint
	ChannelIDs   pq.StringArray `gorm:"type:varchar[]"`
	UserIDs      pq.StringArray `gorm:"type:varchar[]"`
	MessageIDs   pq.StringArray `gorm:"type:varchar[]"`
	ErrorMessage string
}

func (*LogEntry) TableName

func (*LogEntry) TableName() string

type Rule

type Rule struct {
	gorm.Model
	GuildID       string         `gorm:"index;not null"`
	Name          string         `gorm:"not null"`
	TriggerName   string         `gorm:"not null"`
	TriggerValues pq.StringArray `gorm:"type:varchar[]"`
	Filters       []RuleFilter
	Actions       []RuleAction
	Stop          bool
	Silent        bool
	Managed       bool
	Runs          int `gorm:"default:'0'"`
}

func GetRule

func GetRule(
	db *gorm.DB,
	id uint,
) (*Rule, error)

func (*Rule) TableName

func (*Rule) TableName() string

type RuleAction

type RuleAction struct {
	gorm.Model
	RuleID uint
	Name   string         `gorm:"not null"`
	Values pq.StringArray `gorm:"type:varchar[]"`
}

func (*RuleAction) TableName

func (*RuleAction) TableName() string

type RuleFilter

type RuleFilter struct {
	gorm.Model
	RuleID uint
	Name   string         `gorm:"not null"`
	Values pq.StringArray `gorm:"type:varchar[]"`
	Not    bool
}

func (*RuleFilter) TableName

func (*RuleFilter) TableName() string

Jump to

Keyboard shortcuts

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