eventlog

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: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionTypeModDM         actionType = "cacophony_mod_dm"
	ActionTypeModNote       actionType = "cacophony_mod_note"
	ActionTypeDiscordBan    actionType = "discord_ban"
	ActionTypeDiscordUnban  actionType = "discord_unban"
	ActionTypeDiscordJoin   actionType = "discord_join"
	ActionTypeDiscordLeave  actionType = "discord_leave"
	ActionTypeChannelCreate actionType = "discord_channel_create"
	ActionTypeRoleCreate    actionType = "discord_role_create"
	ActionTypeGuildUpdate   actionType = "discord_guild_update"
	ActionTypeMemberUpdate  actionType = "discord_member_update"
	ActionTypeChannelUpdate actionType = "discord_channel_update"
	ActionTypeChannelDelete actionType = "discord_channel_delete"
	ActionTypeRoleUpdate    actionType = "discord_role_update"
	ActionTypeRoleDelete    actionType = "discord_role_delete"
	ActionTypeEmojiCreate   actionType = "discord_emoji_create"
	ActionTypeEmojiUpdate   actionType = "discord_emoji_update"
	ActionTypeEmojiDelete   actionType = "discord_emoji_delete"
	ActionTypeWebhookCreate actionType = "discord_webhook_create"
	ActionTypeWebhookUpdate actionType = "discord_webhook_update"
	ActionTypeWebhookDelete actionType = "discord_webhook_delete"
	ActionTypeInviteCreate  actionType = "discord_invite_create"
	ActionTypeInviteUpdate  actionType = "discord_invite_update"
	ActionTypeInviteDelete  actionType = "discord_invite_delete"
)

Actions

View Source
const (
	EntityTypeUser                      entityType = "discord_user"
	EntityTypeRole                      entityType = "discord_role"
	EntityTypeGuild                     entityType = "discord_guild"
	EntityTypeChannel                   entityType = "discord_channel"
	EntityTypeEmoji                     entityType = "discord_emoji"
	EntityTypeWebhook                   entityType = "discord_webhook"
	EntityTypePermission                entityType = "discord_permission"
	EntityTypeColor                     entityType = "discord_color"
	EntityTypeChannelType               entityType = "discord_channel_type"
	EntityTypePermissionOverwrites      entityType = "discord_permission_overwrites"
	EntityTypeDiscordInvite             entityType = "discord_invite"
	EntityTypeGuildVerificationLevel    entityType = "discord_guild_verification_level"
	EntityTypeGuildExplicitContentLevel entityType = "discord_guild_explicit_content_level"
	EntityTypeGuildMfaLevel             entityType = "discord_guild_mfa_level"

	EntityTypeImageURL    entityType = "cacophony_image_url" // TODO: cache?
	EntityTypeMessageCode entityType = "cacophony_message_code"

	EntityTypeText    entityType = "text"
	EntityTypeNumber  entityType = "number"
	EntityTypeBool    entityType = "bool"
	EntityTypeSeconds entityType = "seconds" // TODO
)

Entities

Variables

This section is empty.

Functions

func CreateItem

func CreateItem(db *gorm.DB, publisher *events.Publisher, item *Item) error

func CreateOptionForItem

func CreateOptionForItem(db *gorm.DB, publisher *events.Publisher, id uint, guildID string, option *ItemOption) error

Types

type Item

type Item struct {
	gorm.Model
	UUID uuid.UUID `gorm:"UNIQUE_INDEX;NOT NULL;Type:uuid"`

	GuildID string `gorm:"NOT NULL"`

	ActionType actionType `gorm:"NOT NULL"`

	AuthorID string // Author UserID

	TargetType  entityType
	TargetValue string

	WaitingForAuditLogBackfill bool
	Reverted                   bool

	Options []ItemOption

	LogMessage ItemLogMessage `gorm:"embedded;embedded_prefix:log_message_"`
}

func FindItem

func FindItem(db *gorm.DB, where string, args ...interface{}) (*Item, error)

func FindManyItem

func FindManyItem(db *gorm.DB, limit int, where string, args ...interface{}) ([]Item, error)

func GetItem

func GetItem(db *gorm.DB, id uint) (*Item, error)

func (*Item) Embed

func (i *Item) Embed(state *state.State) *discordgo.MessageEmbed

func (*Item) Revert

func (i *Item) Revert(event *events.Event) error

func (*Item) Summary

func (i *Item) Summary(state *state.State, highlightID string) string

func (*Item) TableName

func (*Item) TableName() string

type ItemLogMessage

type ItemLogMessage struct {
	ChannelID string
	MessageID string
}

type ItemOption

type ItemOption struct {
	gorm.Model
	ItemID uint `gorm:"NOT NULL;unique_index:idx_itemid_authorid_key"`

	AuthorID      string `gorm:"unique_index:idx_itemid_authorid_key"`
	Key           string `gorm:"NOT NULL;unique_index:idx_itemid_authorid_key"`
	PreviousValue string
	NewValue      string
	Type          entityType
}

func (*ItemOption) TableName

func (*ItemOption) TableName() string

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) Action

func (p *Plugin) Action(event *events.Event) bool

func (*Plugin) Help

func (p *Plugin) Help() *common.PluginHelp

func (*Plugin) Names

func (p *Plugin) Names() []string

func (*Plugin) Passthrough

func (p *Plugin) Passthrough() bool

func (*Plugin) Priority

func (p *Plugin) Priority() int

func (*Plugin) Start

func (p *Plugin) Start(params common.StartParameters) error

func (*Plugin) Stop

func (p *Plugin) Stop(params common.StopParameters) error

Jump to

Keyboard shortcuts

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