audit

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEntry

type BaseEntry struct {
	ID       string // ID of the rawEntry.
	UserID   string // ID of the User that performed the action logged by the rawEntry.
	TargetID string // ID of the entity affected by this action.
	Reason   string // Reason why this action was performed.
}

BaseEntry contains the shared fields of every log entries.

type BoolValues

type BoolValues struct {
	Old, New bool
}

BoolValues holds a pair of boolean values.

type ChannelCreate

type ChannelCreate struct {
	BaseEntry

	Name                 string
	Type                 int
	RateLimitPerUser     int
	NSFW                 bool
	PermissionOverwrites []discord.PermissionOverwrite
}

ChannelUpdate is the audit log entry that describes a channel creation. It contains settings this Channel was created with.

func (ChannelCreate) EntryType

func (ChannelCreate) EntryType() EntryType

EntryType implements the LogEntry interface.

type ChannelDelete

type ChannelDelete struct {
	BaseEntry

	Name                 string
	Type                 int
	RateLimitPerUser     int
	NSFW                 bool
	PermissionOverwrites []discord.PermissionOverwrite
}

ChannelUpdate is the audit log entry that describes a channel deletion. It contains settings this channel had before being deleted.

func (ChannelDelete) EntryType

func (ChannelDelete) EntryType() EntryType

EntryType implements the LogEntry interface.

type ChannelOverwriteCreate

type ChannelOverwriteCreate struct {
	BaseEntry

	Type  int
	ID    string
	Allow int
	Deny  int

	RoleName string // Name of the role if Type is "role".
}

ChannelOverwriteCreate is the audit log entry that describes a channel permission overwrite creation. It contains settings this overwrite was created with.

func (ChannelOverwriteCreate) EntryType

func (ChannelOverwriteCreate) EntryType() EntryType

EntryType implements the LogEntry interface.

type ChannelOverwriteDelete

type ChannelOverwriteDelete struct {
	BaseEntry

	Type  int
	ID    string
	Allow int
	Deny  int

	RoleName string // Name of the role if Type is "role".
}

ChannelOverwriteDelete is the audit log entry that describes a channel permission overwrite deletion. It contains settings this overwrite had before being deleted.

func (ChannelOverwriteDelete) EntryType

func (ChannelOverwriteDelete) EntryType() EntryType

EntryType implements the LogEntry interface.

type ChannelOverwriteUpdate

type ChannelOverwriteUpdate struct {
	BaseEntry

	Allow *IntValues
	Deny  *IntValues

	Type     int
	ID       string
	RoleName string // Name of the role if Type is "role".
}

ChannelOverwriteCreate is the audit log entry that describes how a channel permission overwrite was updated. It contains a list of settings that can be updated on a channel permission overwrite. Settings that are not nil are those which were modified. They contain both their old value as well as the new one.

func (ChannelOverwriteUpdate) EntryType

func (ChannelOverwriteUpdate) EntryType() EntryType

EntryType implements the LogEntry interface.

type ChannelUpdate

type ChannelUpdate struct {
	BaseEntry

	Name             *StringValues
	Topic            *StringValues
	Bitrate          *IntValues
	RateLimitPerUser *IntValues
	NSFW             *BoolValues
	ApplicationID    *StringValues // Application ID of the added or removed webhook or bot.
	Position         *IntValues
}

ChannelUpdate is the audit log entry that describes how a channel was updated. It contains a list of settings that can be updated on a channel. Settings that are not nil are those which were modified. They contain both their old value as well as the new one.

func (ChannelUpdate) EntryType

func (ChannelUpdate) EntryType() EntryType

EntryType implements the LogEntry interface.

type EmojiCreate

type EmojiCreate struct {
	BaseEntry

	Name string
}

EmojiCreate is the audit log entry that describes an emoji creation. It contains the settings the emoji was created with.

func (EmojiCreate) EntryType

func (EmojiCreate) EntryType() EntryType

EntryType implements the LogEntry interface.

type EmojiDelete

type EmojiDelete struct {
	BaseEntry

	Name string
}

EmojiCreate is the audit log entry that describes an emoji delete. It contains settings this emoji had before being deleted.

func (EmojiDelete) EntryType

func (EmojiDelete) EntryType() EntryType

EntryType implements the LogEntry interface.

type EmojiUpdate

type EmojiUpdate struct {
	BaseEntry

	Name *StringValues
}

EmojiUpdate is the audit log entry that describes how an emoji was updated. It contains a list of settings that can be updated on an emoji. Settings that are not nil are those which were modified. They contain both their old value as well as the new one.

func (EmojiUpdate) EntryType

func (EmojiUpdate) EntryType() EntryType

EntryType implements the LogEntry interface.

type EntryType

type EntryType int

EntryType defines the type of event an audit log entry describes.

const (
	EntryTypeGuildUpdate            EntryType = 1
	EntryTypeChannelCreate          EntryType = 10
	EntryTypeChannelUpdate          EntryType = 11
	EntryTypeChannelDelete          EntryType = 12
	EntryTypeChannelOverwriteCreate EntryType = 13
	EntryTypeChannelOverwriteUpdate EntryType = 14
	EntryTypeChannelOverwriteDelete EntryType = 15
	EntryTypeMemberKick             EntryType = 20
	EntryTypeMemberPrune            EntryType = 21
	EntryTypeMemberBanAdd           EntryType = 22
	EntryTypeMemberBanRemove        EntryType = 23
	EntryTypeMemberUpdate           EntryType = 24
	EntryTypeMemberRoleUpdate       EntryType = 25
	EntryTypeRoleCreate             EntryType = 30
	EntryTypeRoleUpdate             EntryType = 31
	EntryTypeRoleDelete             EntryType = 32
	EntryTypeInviteCreate           EntryType = 40
	EntryTypeInviteUpdate           EntryType = 41
	EntryTypeInviteDelete           EntryType = 42
	EntryTypeWebhookCreate          EntryType = 50
	EntryTypeWebhookUpdate          EntryType = 51
	EntryTypeWebhookDelete          EntryType = 52
	EntryTypeEmojiCreate            EntryType = 60
	EntryTypeEmojiUpdate            EntryType = 61
	EntryTypeEmojiDelete            EntryType = 62
	EntryTypeMessageDelete          EntryType = 72
)

Possible entry type values, as defined here: https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events

type GuildUpdate

type GuildUpdate struct {
	BaseEntry

	Name                       *StringValues
	IconHash                   *StringValues
	SplashHash                 *StringValues
	OwnerID                    *StringValues
	Region                     *StringValues
	AFKChannelID               *StringValues
	AFKTimeout                 *IntValues
	MFALevel                   *IntValues
	VerificationLevel          *IntValues
	ExplicitContentFilter      *IntValues
	DefaultMessageNotification *IntValues
	VanityURLCode              *StringValues
	PruneDeleteDays            *IntValues
	WidgetEnabled              *BoolValues
	WidgetChannelID            *StringValues
}

GuildUpdate is the audit log entry that describes how a guild was updated. It contains a list of settings that can be updated on a guild. Settings that are not nil are those which were modified. They contain both their old value as well as the new one.

func (GuildUpdate) EntryType

func (GuildUpdate) EntryType() EntryType

EntryType implements the LogEntry interface.

type IntValues

type IntValues struct {
	Old, New int
}

IntValues holds a pair of integer values.

type InviteCreate

type InviteCreate struct {
	BaseEntry

	Code      string
	ChannelID string
	InviterID string
	MaxUses   int
	Uses      int
	MaxAge    int
	Temporary bool
}

InviteCreate is the audit log entry that describes a channel invite creation. It contains the settings the invite was created with.

func (InviteCreate) EntryType

func (InviteCreate) EntryType() EntryType

EntryType implements the LogEntry interface.

type InviteDelete

type InviteDelete struct {
	BaseEntry

	Code      string
	ChannelID string
	InviterID string
	MaxUses   int
	Uses      int
	MaxAge    int
	Temporary bool
}

InviteDelete is the audit log entry that describes a channel invite deletion. It contains settings this invite had before being deleted.

func (InviteDelete) EntryType

func (InviteDelete) EntryType() EntryType

EntryType implements the LogEntry interface.

type InviteUpdate

type InviteUpdate struct {
	BaseEntry

	Code      *StringValues
	ChannelID *StringValues
	InviterID *StringValues
	MaxUses   *IntValues
	Uses      *IntValues
	MaxAge    *IntValues
	Temporary *BoolValues
}

InviteUpdate is the audit log entry that describes how a channel invite was updated. It contains a list of settings that can be updated on an invite. Settings that are not nil are those which were modified. They contain both their old value as well as the new one.

func (InviteUpdate) EntryType

func (InviteUpdate) EntryType() EntryType

EntryType implements the LogEntry interface.

type Log

type Log struct {
	Entries  []LogEntry
	Users    []PartialUser
	Webhooks []PartialWebhook
}

Log is the audit log of a Guild. It contains a list of entries that map to every admin actions performed on a Guild.

func ParseRaw

func ParseRaw(raw json.RawMessage) (*Log, error)

ParseRaw parses a raw, JSON-encoded audit log returned by Discord's API into a typed and structured Log. It is not intended to be used by end user and is only exposed so harmony.AuditLog can use it.

type LogEntry

type LogEntry interface {
	EntryType() EntryType
}

LogEntry represents a single rawEntry in the audit log. Entries are defined by the EntryType they describe.

type MemberBanAdd

type MemberBanAdd struct {
	BaseEntry
}

MemberBanAdd is the audit log entry that describes a guild member ban creation.

func (MemberBanAdd) EntryType

func (MemberBanAdd) EntryType() EntryType

EntryType implements the LogEntry interface.

type MemberBanRemove

type MemberBanRemove struct {
	BaseEntry
}

MemberBanRemove is the audit log entry that describes a guild member ban deletion.

func (MemberBanRemove) EntryType

func (MemberBanRemove) EntryType() EntryType

EntryType implements the LogEntry interface.

type MemberKick

type MemberKick struct {
	BaseEntry
}

MemberKick is the audit log entry that describes a guild member kick.

func (MemberKick) EntryType

func (MemberKick) EntryType() EntryType

EntryType implements the LogEntry interface.

type MemberPrune

type MemberPrune struct {
	BaseEntry

	DeleteMemberDays int
	MembersRemoved   int
}

MemberKick is the audit log entry that describes a guild member prune.

func (MemberPrune) EntryType

func (MemberPrune) EntryType() EntryType

EntryType implements the LogEntry interface.

type MemberRoleUpdate

type MemberRoleUpdate struct {
	BaseEntry

	Added   []discord.PermissionOverwrite
	Removed []discord.PermissionOverwrite
}

MemberRoleUpdate is the audit log entry that describes a guild member's roles update. It contains roles that were added as well as roles that were removed.

func (MemberRoleUpdate) EntryType

func (MemberRoleUpdate) EntryType() EntryType

EntryType implements the LogEntry interface.

type MemberUpdate

type MemberUpdate struct {
	BaseEntry

	Nick *StringValues
	Deaf *BoolValues
	Mute *BoolValues
}

MemberUpdate is the audit log entry that describes a guild member update. It contains a list of settings that can be updated on a guild member. Settings that are not nil are those which were modified. They contain both their old value as well as the new one.

func (MemberUpdate) EntryType

func (MemberUpdate) EntryType() EntryType

EntryType implements the LogEntry interface.

type MessageDelete

type MessageDelete struct {
	BaseEntry

	ChannelID string
	Count     int
}

EmojiCreate is the audit log entry that describes the deletion of messages.

func (MessageDelete) EntryType

func (MessageDelete) EntryType() EntryType

EntryType implements the LogEntry interface.

type PartialUser

type PartialUser struct {
	ID            string `json:"id,omitempty"`
	Username      string `json:"username,omitempty"`
	Discriminator string `json:"discriminator,omitempty"`
	Avatar        string `json:"avatar,omitempty"`
	Bot           bool   `json:"bot,omitempty"`
}

PartialUser contains a subset of the regular harmony.User type.

type PartialWebhook

type PartialWebhook struct {
	ID        string `json:"id,omitempty"`
	GuildID   string `json:"guild_id,omitempty"`
	ChannelID string `json:"channel_id,omitempty"`
	Name      string `json:"name,omitempty"`
	Avatar    string `json:"avatar,omitempty"`
}

PartialWebhook contains a subset of the regular harmony.Webhook type.

type RoleCreate

type RoleCreate struct {
	BaseEntry

	Name        string
	Permissions int
	Color       int
	Mentionable bool
	Hoist       bool
}

RoleCreate is the audit log entry that describes a role creation. It contains the settings the role was created with.

func (RoleCreate) EntryType

func (RoleCreate) EntryType() EntryType

EntryType implements the LogEntry interface.

type RoleDelete

type RoleDelete struct {
	BaseEntry

	Name        string
	Permissions int
	Color       int
	Mentionable bool
	Hoist       bool
}

RoleDelete is the audit log entry that describes a role deletion. It contains settings this role had before being deleted.

func (RoleDelete) EntryType

func (RoleDelete) EntryType() EntryType

EntryType implements the LogEntry interface.

type RoleUpdate

type RoleUpdate struct {
	BaseEntry

	Name        *StringValues
	Permissions *IntValues
	Color       *IntValues
	Mentionable *BoolValues
	Hoist       *BoolValues
}

RoleUpdate is the audit log entry that describes how a role was updated. It contains a list of settings that can be updated on a role. Settings that are not nil are those which were modified. They contain both their old value as well as the new one.

func (RoleUpdate) EntryType

func (RoleUpdate) EntryType() EntryType

EntryType implements the LogEntry interface.

type StringValues

type StringValues struct {
	Old, New string
}

StringValues holds a pair of string values.

type WebhookCreate

type WebhookCreate struct {
	BaseEntry

	Name      string
	Type      int
	ChannelID string
}

InviteDelete is the audit log entry that describes a webhook creation. It contains the settings the webhook was created with.

func (WebhookCreate) EntryType

func (WebhookCreate) EntryType() EntryType

EntryType implements the LogEntry interface.

type WebhookDelete

type WebhookDelete struct {
	BaseEntry

	Name      string
	Type      int
	ChannelID string
}

WebhookDelete is the audit log entry that describes a webhook deletion. It contains settings this webhook had before being deleted.

func (WebhookDelete) EntryType

func (WebhookDelete) EntryType() EntryType

EntryType implements the LogEntry interface.

type WebhookUpdate

type WebhookUpdate struct {
	BaseEntry

	Name       *StringValues
	ChannelID  *StringValues
	AvatarHash *StringValues
}

WebhookUpdate is the audit log entry that describes how a webhook was updated. It contains a list of settings that can be updated on a webhook. Settings that are not nil are those which were modified. They contain both their old value as well as the new one.

func (WebhookUpdate) EntryType

func (WebhookUpdate) EntryType() EntryType

EntryType implements the LogEntry interface.

Jump to

Keyboard shortcuts

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