cplogs

package
v2.33.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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