auditlog

package
v0.0.0-...-a139185 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrBeforeNil = errors.Sentinel("before is nil")
	ErrAfterNil  = errors.Sentinel("after is nil")

	ErrInvalidSubjectType = errors.Sentinel("invalid subject")
)

...

View Source
const ErrAuditLogSendFailed = errors.Sentinel("failed to send one or both audit log entries")

ErrAuditLogSendFailed ...

Variables

This section is empty.

Functions

func Init

func Init(bot *bot.Bot, perms bcr.CustomPerms) (s string, list []*bcr.Command)

Init ...

Types

type ActionType

type ActionType string

ActionType ...

const (
	CreateAction ActionType = "create"
	UpdateAction ActionType = "update"
	DeleteAction ActionType = "delete"
)

...

type AuditLog

type AuditLog struct {
	State *state.State

	*bot.Bot
}

AuditLog ...

func New

func New(bot *bot.Bot) *AuditLog

New returns a new AuditLog object.

func (*AuditLog) SendLog

func (bot *AuditLog) SendLog(subjectID int, subjectType EntrySubject, actionType ActionType, before, after interface{}, userID discord.UserID, reason *string) (id int64, err error)

SendLog sends an audit log

type Entry

type Entry struct {
	ID int64

	SubjectID int
	Subject   EntrySubject
	Action    ActionType

	Before json.RawMessage
	After  json.RawMessage

	UserID discord.UserID
	Reason sql.NullString

	Timestamp time.Time

	PublicMessageID  discord.MessageID
	PrivateMessageID discord.MessageID
}

Entry ...

func (*Entry) AfterExplanation

func (e *Entry) AfterExplanation() (ex db.Explanation, err error)

AfterExplanation gets the entry's After as a db.Explanation

func (*Entry) AfterPronouns

func (e *Entry) AfterPronouns() (p db.PronounSet, err error)

AfterPronouns gets the entry's After as a db.PronounSet

func (*Entry) AfterTerm

func (e *Entry) AfterTerm() (t db.Term, err error)

AfterTerm gets the entry's After as a db.Term

func (*Entry) BeforeExplanation

func (e *Entry) BeforeExplanation() (ex db.Explanation, err error)

BeforeExplanation gets the entry's Before as a db.Explanation

func (*Entry) BeforePronouns

func (e *Entry) BeforePronouns() (p db.PronounSet, err error)

BeforePronouns gets the entry's Before as a db.PronounSet

func (*Entry) BeforeTerm

func (e *Entry) BeforeTerm() (t db.Term, err error)

BeforeTerm gets the entry's Before as a db.Term

type EntrySubject

type EntrySubject string

EntrySubject ...

const (
	TermEntry        EntrySubject = "term"
	PronounsEntry    EntrySubject = "pronouns"
	ExplanationEntry EntrySubject = "explanation"
)

...

Jump to

Keyboard shortcuts

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