cplogs

package
v1.24.24 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DBSchema = `` /* 449-byte string literal not displayed */

Variables

This section is empty.

Functions

func AddEntry

func AddEntry(entry *LogEntry) error

AddEntry adds a entry to the database, also generating a "LocalID" for this entry

func RegisterActionFormat

func RegisterActionFormat(format *ActionFormat) string

RegisterActionFormat sets up a action format, call this in your package init function

func RetryAddEntry

func RetryAddEntry(entry *LogEntry)

RetryAddEntry will etry AddEntry until it suceeds or 60 seconds has elapsed

Types

type ActionFormat

type ActionFormat struct {
	Key          string
	FormatString string
	Found        bool
}

type LogAction

type LogAction struct {
	Key       string
	FormatStr string
	Params    []*Param
}

func (*LogAction) String

func (l *LogAction) String() string

type LogEntry

type LogEntry struct {
	GuildID int64
	LocalID int64

	AuthorID       int64
	AuthorUsername string

	Action *LogAction

	CreatedAt time.Time
}

func GetEntries

func GetEntries(guildID int64, limit int, before int64) ([]*LogEntry, error)

func NewEntry

func NewEntry(guildID int64, authorID int64, authorUsername string, action string, params ...*Param) *LogEntry

type Param

type Param struct {
	Type  ParamType
	Value interface{}
}

type ParamType

type ParamType uint8
const (
	ParamTypeNone   ParamType = 0
	ParamTypeInt    ParamType = 1
	ParamTypeString ParamType = 2
)

Jump to

Keyboard shortcuts

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