2020-05-08 00:09:45 +00:00
|
|
|
package discord
|
|
|
|
|
2020-05-08 03:01:44 +00:00
|
|
|
import (
|
2023-09-19 15:23:25 +00:00
|
|
|
"fmt"
|
2021-05-20 22:47:44 +00:00
|
|
|
"time"
|
|
|
|
|
2021-06-02 02:53:19 +00:00
|
|
|
"github.com/diamondburned/arikawa/v3/utils/json"
|
2020-05-08 03:01:44 +00:00
|
|
|
)
|
2020-05-08 00:09:45 +00:00
|
|
|
|
2020-05-18 12:53:42 +00:00
|
|
|
// https://discord.com/developers/docs/resources/audit-log#audit-log-object
|
2020-05-08 00:09:45 +00:00
|
|
|
type AuditLog struct {
|
2020-05-18 12:53:42 +00:00
|
|
|
// Webhooks is the list of webhooks found in the audit log.
|
2020-05-08 00:09:45 +00:00
|
|
|
Webhooks []Webhook `json:"webhooks"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// Users is the list of users found in the audit log.
|
2020-05-08 00:09:45 +00:00
|
|
|
Users []User `json:"users"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// Entries is the list of audit log entries.
|
2020-05-08 03:01:44 +00:00
|
|
|
Entries []AuditLogEntry `json:"audit_log_entries"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// Integrations is a list ist of partial integration objects (only ID,
|
|
|
|
// Name, Type, and Account).
|
2020-05-08 00:09:45 +00:00
|
|
|
Integrations []Integration `json:"integrations"`
|
|
|
|
}
|
|
|
|
|
2020-05-08 03:01:44 +00:00
|
|
|
// AuditLogEntry is a single entry in the audit log.
|
2020-05-18 12:53:42 +00:00
|
|
|
//
|
|
|
|
// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object
|
2020-05-08 03:01:44 +00:00
|
|
|
type AuditLogEntry struct {
|
2020-05-18 12:53:42 +00:00
|
|
|
// ID is the id of the entry.
|
2020-07-21 20:27:59 +00:00
|
|
|
ID AuditLogEntryID `json:"id"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// TargetID is the id of the affected entity (webhook, user, role, etc.).
|
2020-11-22 14:48:36 +00:00
|
|
|
TargetID Snowflake `json:"target_id"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// Changes are the changes made to the TargetID.
|
|
|
|
Changes []AuditLogChange `json:"changes,omitempty"`
|
|
|
|
// UserID is the id of the user who made the changes.
|
2020-07-21 20:27:59 +00:00
|
|
|
UserID UserID `json:"user_id"`
|
2020-05-08 00:09:45 +00:00
|
|
|
|
2020-05-18 12:53:42 +00:00
|
|
|
// ActionType is the type of action that occurred.
|
2020-05-08 00:09:45 +00:00
|
|
|
ActionType AuditLogEvent `json:"action_type"`
|
|
|
|
|
2020-05-18 12:53:42 +00:00
|
|
|
// Options contains additional info for certain action types.
|
|
|
|
Options AuditEntryInfo `json:"options,omitempty"`
|
|
|
|
// Reason is the reason for the change (0-512 characters).
|
|
|
|
Reason string `json:"reason,omitempty"`
|
2020-05-08 00:09:45 +00:00
|
|
|
}
|
|
|
|
|
2021-05-20 22:47:44 +00:00
|
|
|
// CreatedAt returns a time object representing when the audit log entry was created.
|
|
|
|
func (e AuditLogEntry) CreatedAt() time.Time {
|
|
|
|
return e.ID.Time()
|
|
|
|
}
|
|
|
|
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditLogEvent is the type of audit log action that occurred.
|
2020-05-08 00:09:45 +00:00
|
|
|
type AuditLogEvent uint8
|
|
|
|
|
2020-05-18 12:53:42 +00:00
|
|
|
// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
|
2020-05-08 00:09:45 +00:00
|
|
|
const (
|
|
|
|
GuildUpdate AuditLogEvent = 1
|
|
|
|
ChannelCreate AuditLogEvent = 10
|
|
|
|
ChannelUpdate AuditLogEvent = 11
|
|
|
|
ChannelDelete AuditLogEvent = 12
|
|
|
|
ChannelOverwriteCreate AuditLogEvent = 13
|
|
|
|
ChannelOverwriteUpdate AuditLogEvent = 14
|
|
|
|
ChannelOverwriteDelete AuditLogEvent = 15
|
|
|
|
MemberKick AuditLogEvent = 20
|
|
|
|
MemberPrune AuditLogEvent = 21
|
|
|
|
MemberBanAdd AuditLogEvent = 22
|
|
|
|
MemberBanRemove AuditLogEvent = 23
|
|
|
|
MemberUpdate AuditLogEvent = 24
|
|
|
|
MemberRoleUpdate AuditLogEvent = 25
|
|
|
|
MemberMove AuditLogEvent = 26
|
|
|
|
MemberDisconnect AuditLogEvent = 27
|
|
|
|
BotAdd AuditLogEvent = 28
|
|
|
|
RoleCreate AuditLogEvent = 30
|
|
|
|
RoleUpdate AuditLogEvent = 31
|
|
|
|
RoleDelete AuditLogEvent = 32
|
|
|
|
InviteCreate AuditLogEvent = 40
|
|
|
|
InviteUpdate AuditLogEvent = 41
|
|
|
|
InviteDelete AuditLogEvent = 42
|
|
|
|
WebhookCreate AuditLogEvent = 50
|
|
|
|
WebhookUpdate AuditLogEvent = 51
|
|
|
|
WebhookDelete AuditLogEvent = 52
|
|
|
|
EmojiCreate AuditLogEvent = 60
|
|
|
|
EmojiUpdate AuditLogEvent = 61
|
|
|
|
EmojiDelete AuditLogEvent = 62
|
|
|
|
MessageDelete AuditLogEvent = 72
|
|
|
|
MessageBulkDelete AuditLogEvent = 73
|
|
|
|
MessagePin AuditLogEvent = 74
|
|
|
|
MessageUnpin AuditLogEvent = 75
|
|
|
|
IntegrationCreate AuditLogEvent = 80
|
|
|
|
IntegrationUpdate AuditLogEvent = 81
|
|
|
|
IntegrationDelete AuditLogEvent = 82
|
|
|
|
)
|
|
|
|
|
2020-05-18 12:53:42 +00:00
|
|
|
// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
|
2020-05-08 00:09:45 +00:00
|
|
|
type AuditEntryInfo struct {
|
2023-09-01 10:45:21 +00:00
|
|
|
// ApplicationID is the ID of the application whose permissions were targeted.
|
|
|
|
//
|
|
|
|
// Events: APPLICATION_COMMAND_PERMISSION_UPDATE
|
|
|
|
ApplicationID AppID `json:"application_id"`
|
|
|
|
// AutoModerationRuleName is the name of the Auto Moderation rule that was triggered.
|
|
|
|
//
|
|
|
|
// Events: AUTO_MODERATION_BLOCK_MESSAGE, AUTO_MODERATION_FLAG_TO_CHANNEL, AUTO_MODERATION_USER_COMMUNICATION_DISABLED
|
|
|
|
AutoModerationRuleName string `json:"auto_moderation_rule_name"`
|
|
|
|
// AutoModerationRuleTriggerType is the trigger type of the Auto Moderation rule that was triggered.
|
|
|
|
//
|
|
|
|
// Events: AUTO_MODERATION_BLOCK_MESSAGE, AUTO_MODERATION_FLAG_TO_CHANNEL, AUTO_MODERATION_USER_COMMUNICATION_DISABLED
|
|
|
|
AutoModerationRuleTriggerType string `json:"auto_moderation_rule_trigger_type"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// DeleteMemberDays is the number of days after which inactive members were
|
|
|
|
// kicked.
|
|
|
|
//
|
|
|
|
// Events: MEMBER_PRUNE
|
2020-05-08 00:09:45 +00:00
|
|
|
DeleteMemberDays string `json:"delete_member_days,omitempty"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// MembersRemoved is the number of members removed by the prune.
|
|
|
|
//
|
|
|
|
// Events: MEMBER_PRUNE
|
2020-05-08 00:09:45 +00:00
|
|
|
MembersRemoved string `json:"members_removed,omitempty"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// ChannelID is the id of the channel in which the entities were targeted.
|
|
|
|
//
|
|
|
|
// Events: MEMBER_MOVE, MESSAGE_PIN, MESSAGE_UNPIN, MESSAGE_DELETE
|
2020-07-21 20:27:59 +00:00
|
|
|
ChannelID ChannelID `json:"channel_id,omitempty"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// MessagesID is the id of the message that was targeted.
|
|
|
|
//
|
|
|
|
// Events: MESSAGE_PIN, MESSAGE_UNPIN
|
2020-07-21 20:27:59 +00:00
|
|
|
MessageID MessageID `json:"message_id,omitempty"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// Count is the number of entities that were targeted.
|
|
|
|
//
|
|
|
|
// Events: MESSAGE_DELETE, MESSAGE_BULK_DELETE, MEMBER_DISCONNECT,
|
|
|
|
// MEMBER_MOVE
|
2020-05-08 00:09:45 +00:00
|
|
|
Count string `json:"count,omitempty"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// ID is the id of the overwritten entity.
|
|
|
|
//
|
|
|
|
// Events: CHANNEL_OVERWRITE_CREATE, CHANNEL_OVERWRITE_UPDATE,
|
|
|
|
// CHANNEL_OVERWRITE_DELETE
|
2020-05-08 00:09:45 +00:00
|
|
|
ID Snowflake `json:"id,omitempty"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// Type is the type of overwritten entity.
|
|
|
|
//
|
|
|
|
// Events: CHANNEL_OVERWRITE_CREATE, CHANNEL_OVERWRITE_UPDATE,
|
|
|
|
// CHANNEL_OVERWRITE_DELETE
|
2020-10-28 22:34:14 +00:00
|
|
|
Type OverwriteType `json:"type,string,omitempty"`
|
2020-05-18 12:53:42 +00:00
|
|
|
// RoleName is the name of the role if type is "role".
|
|
|
|
//
|
|
|
|
// Events: CHANNEL_OVERWRITE_CREATE, CHANNEL_OVERWRITE_UPDATE,
|
|
|
|
// CHANNEL_OVERWRITE_DELETE
|
2020-05-08 00:09:45 +00:00
|
|
|
RoleName string `json:"role_name,omitempty"`
|
2023-09-01 10:45:21 +00:00
|
|
|
// IntegrationType is the type of the integration which performed the action.
|
|
|
|
//
|
|
|
|
// Events: MEMBER_KICK, MEMBER_ROLE_UPDATE
|
|
|
|
IntegrationType string `json:"integration_type"`
|
2020-05-08 00:09:45 +00:00
|
|
|
}
|
|
|
|
|
2020-05-08 03:01:44 +00:00
|
|
|
// AuditLogChange is a single key type to changed value audit log entry. The
|
|
|
|
// type can be found in the key's comment. Values can be nil.
|
|
|
|
//
|
2023-09-19 15:23:25 +00:00
|
|
|
// # What
|
2020-05-08 03:01:44 +00:00
|
|
|
//
|
|
|
|
// I'm glad to see the same reaction that I had on you. In short, in this
|
|
|
|
// struct, the Key dictates what type NewValue and OldValue will have. They will
|
|
|
|
// always be the same type, but I will leave that as JSON for the user.
|
|
|
|
//
|
2023-09-19 15:23:25 +00:00
|
|
|
// # Usage
|
2020-05-08 03:01:44 +00:00
|
|
|
//
|
|
|
|
// The usage of this is pretty simple, as AuditLogChange already has a
|
|
|
|
// convenient method to use. Here's an example on how to do "owner_id":
|
|
|
|
//
|
2023-09-19 15:23:25 +00:00
|
|
|
// if change.Key != discord.AuditGuildOwnerID {
|
|
|
|
// return errors.New("not owner ID")
|
|
|
|
// }
|
2020-05-08 03:01:44 +00:00
|
|
|
//
|
2023-09-19 15:23:25 +00:00
|
|
|
// // We know these are UserIDs because the comment said so for AuditGuildOwnerID.
|
|
|
|
// var oldOwnerID, newOwnerID discord.UserID
|
|
|
|
// if err := change.UnmarshalValues(&oldOwnerID, &newOwnerID); err != nil {
|
|
|
|
// return err
|
|
|
|
// }
|
2020-05-08 03:01:44 +00:00
|
|
|
//
|
2023-09-19 15:23:25 +00:00
|
|
|
// log.Println("Transferred ownership from user", oldOwnerID, "to", newOwnerID)
|
2020-05-08 00:09:45 +00:00
|
|
|
type AuditLogChange struct {
|
2020-05-18 12:53:42 +00:00
|
|
|
// Key is the name of audit log change key.
|
|
|
|
Key AuditLogChangeKey `json:"key"`
|
|
|
|
// NewValue is the new value of the key.
|
|
|
|
NewValue json.Raw `json:"new_value,omitempty"`
|
|
|
|
// OldValue is the old value of the key.
|
|
|
|
OldValue json.Raw `json:"old_value,omitempty"`
|
2020-05-08 00:09:45 +00:00
|
|
|
}
|
|
|
|
|
2020-05-18 12:53:42 +00:00
|
|
|
// UnmarshalValues unmarshals the values of the AuditLogChange into the passed
|
|
|
|
// interfaces.
|
2020-05-08 03:01:44 +00:00
|
|
|
func (a AuditLogChange) UnmarshalValues(old, new interface{}) error {
|
|
|
|
if err := a.NewValue.UnmarshalTo(new); err != nil {
|
2023-09-19 15:23:25 +00:00
|
|
|
return fmt.Errorf("failed to unmarshal old value: %w", err)
|
2020-05-08 03:01:44 +00:00
|
|
|
}
|
|
|
|
if err := a.OldValue.UnmarshalTo(old); err != nil {
|
2023-09-19 15:23:25 +00:00
|
|
|
return fmt.Errorf("failed to unmarshal new value: %w", err)
|
2020-05-08 03:01:44 +00:00
|
|
|
}
|
|
|
|
return nil
|
2020-05-08 00:09:45 +00:00
|
|
|
}
|
|
|
|
|
2020-05-08 03:01:44 +00:00
|
|
|
type AuditLogChangeKey string
|
2020-05-08 00:09:45 +00:00
|
|
|
|
2020-05-18 12:53:42 +00:00
|
|
|
// https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-key
|
2020-05-08 03:01:44 +00:00
|
|
|
const (
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildName gets sent if the guild's name was changed.
|
|
|
|
//
|
|
|
|
// Type: string
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildName AuditLogChangeKey = "name"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildIconHash gets sent if the guild's icon was changed.
|
|
|
|
//
|
|
|
|
// Type: Hash
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildIconHash AuditLogChangeKey = "icon_hash"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildSplashHash gets sent if the guild's invite splash page artwork
|
|
|
|
// was changed.
|
|
|
|
//
|
|
|
|
// Type: Hash
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildSplashHash AuditLogChangeKey = "splash_hash"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildOwnerID gets sent if the guild's owner changed.
|
|
|
|
//
|
2020-07-21 20:27:59 +00:00
|
|
|
// Type: UserID
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildOwnerID AuditLogChangeKey = "owner_id"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildRegion gets sent if the guild's region changed.
|
|
|
|
//
|
|
|
|
// Type: string
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildRegion AuditLogChangeKey = "region"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildAFKChannelID gets sent if the guild's afk channel changed.
|
|
|
|
//
|
2020-07-21 20:27:59 +00:00
|
|
|
// Type: ChannelID
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildAFKChannelID AuditLogChangeKey = "afk_channel_id"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildAFKTimeout gets sent if the guild's afk timeout duration
|
|
|
|
// changed.
|
|
|
|
//
|
|
|
|
// Type: Seconds
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildAFKTimeout AuditLogChangeKey = "afk_timeout"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildMFA gets sent if the two-factor auth requirement changed.
|
|
|
|
//
|
|
|
|
// Type: MFALevel
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildMFA AuditLogChangeKey = "mfa_level"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildVerification gets sent if the guild's required verification
|
|
|
|
// level changed
|
|
|
|
//
|
|
|
|
// Type: Verification
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildVerification AuditLogChangeKey = "verification_level"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildExplicitFilter gets sent if there was a change in whose
|
|
|
|
// messages are scanned and deleted for explicit content in the server.
|
|
|
|
//
|
|
|
|
// Type: ExplicitFilter
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildExplicitFilter AuditLogChangeKey = "explicit_content_filter"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildNotification gets sent if the default message notification
|
|
|
|
// level changed.
|
|
|
|
//
|
|
|
|
// Type: Notification
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildNotification AuditLogChangeKey = "default_message_notifications"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildVanityURLCode gets sent if the guild invite vanity URL
|
|
|
|
// changed.
|
|
|
|
//
|
|
|
|
// Type: string
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildVanityURLCode AuditLogChangeKey = "vanity_url_code"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildRoleAdd gets sent if a new role was added.
|
|
|
|
//
|
|
|
|
// Type: []Role{ID, Name}
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildRoleAdd AuditLogChangeKey = "$add"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildRoleRemove gets sent if a role was removed.
|
|
|
|
//
|
|
|
|
// Type: []Role{ID, Name}
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildRoleRemove AuditLogChangeKey = "$remove"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildPruneDeleteDays gets sent if there was a change in number of
|
|
|
|
// days after which inactive and role-unassigned members are kicked.
|
|
|
|
//
|
|
|
|
// Type: int
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildPruneDeleteDays AuditLogChangeKey = "prune_delete_days"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildWidgetEnabled gets sent if the guild's widget was
|
|
|
|
// enabled/disabled.
|
|
|
|
//
|
|
|
|
// Type: bool
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildWidgetEnabled AuditLogChangeKey = "widget_enabled"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildWidgetChannelID gets sent if the channel ID of the guild
|
|
|
|
// widget changed.
|
|
|
|
//
|
2020-07-21 20:27:59 +00:00
|
|
|
// Type: ChannelID
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildWidgetChannelID AuditLogChangeKey = "widget_channel_id"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditGuildSystemChannelID gets sent if the ID of the guild's system
|
|
|
|
// channel changed.
|
|
|
|
//
|
2020-07-21 20:27:59 +00:00
|
|
|
// Type: ChannelID
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditGuildSystemChannelID AuditLogChangeKey = "system_channel_id"
|
|
|
|
)
|
2020-05-08 00:09:45 +00:00
|
|
|
|
2020-05-08 03:01:44 +00:00
|
|
|
const (
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditChannelPosition gets sent if a text or voice channel position was
|
|
|
|
// changed.
|
|
|
|
//
|
|
|
|
// Type: int
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditChannelPosition AuditLogChangeKey = "position"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditChannelTopic gets sent if the text channel topic changed.
|
|
|
|
//
|
|
|
|
// Type: string
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditChannelTopic AuditLogChangeKey = "topic"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditChannelBitrate gets sent if the voice channel bitrate changed.
|
|
|
|
//
|
|
|
|
// Type: uint
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditChannelBitrate AuditLogChangeKey = "bitrate"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditChannelPermissionOverwrites gets sent if the permissions on a
|
|
|
|
// channel changed.
|
|
|
|
//
|
|
|
|
// Type: []Overwrite
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditChannelPermissionOverwrites AuditLogChangeKey = "permission_overwrites"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditChannelNSFW gets sent if the channel NSFW restriction changed.
|
|
|
|
//
|
|
|
|
// Type: bool
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditChannelNSFW AuditLogChangeKey = "nsfw"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditChannelApplicationID contains the application ID of the added or
|
|
|
|
// removed webhook or bot.
|
|
|
|
//
|
2020-07-21 20:27:59 +00:00
|
|
|
// Type: AppID
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditChannelApplicationID AuditLogChangeKey = "application_id"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditChannelRateLimitPerUser gets sent if the amount of seconds a user
|
|
|
|
// has to wait before sending another message changed.
|
|
|
|
//
|
|
|
|
// Type: Seconds
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditChannelRateLimitPerUser AuditLogChangeKey = "rate_limit_per_user"
|
|
|
|
)
|
2020-05-08 00:09:45 +00:00
|
|
|
|
2020-05-08 03:01:44 +00:00
|
|
|
const (
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditRolePermissions gets sent if the permissions for a role changed.
|
|
|
|
//
|
|
|
|
// Type: Permissions
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditRolePermissions AuditLogChangeKey = "permissions"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditRoleColor gets sent if the role color changed.
|
|
|
|
//
|
|
|
|
// Type: Color
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditRoleColor AuditLogChangeKey = "color"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditRoleHoist gets sent if the role is now displayed/no longer
|
|
|
|
// displayed separate from online users.
|
|
|
|
//
|
|
|
|
// Type: bool
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditRoleHoist AuditLogChangeKey = "hoist"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditRoleMentionable gets sent if a role is now
|
|
|
|
// mentionable/unmentionable.
|
|
|
|
//
|
|
|
|
// Type: bool
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditRoleMentionable AuditLogChangeKey = "mentionable"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditRoleAllow gets sent if a permission on a text or voice channel was
|
|
|
|
// allowed for a role.
|
|
|
|
//
|
|
|
|
// Type: Permissions
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditRoleAllow AuditLogChangeKey = "allow"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditRoleDeny gets sent if a permission on a text or voice channel was
|
|
|
|
// denied for a role.
|
|
|
|
//
|
|
|
|
// Type: Permissions
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditRoleDeny AuditLogChangeKey = "deny"
|
|
|
|
)
|
2020-05-08 00:09:45 +00:00
|
|
|
|
2020-05-08 03:01:44 +00:00
|
|
|
const (
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditInviteCode gets sent if an invite code changed.
|
|
|
|
//
|
|
|
|
// Type: string
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditInviteCode AuditLogChangeKey = "code"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditInviteChannelID gets sent if the channel for an invite code
|
|
|
|
// changed.
|
|
|
|
//
|
2020-07-21 20:27:59 +00:00
|
|
|
// Type: ChannelID
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditInviteChannelID AuditLogChangeKey = "channel_id"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditInviteInviterID specifies the person who created invite code
|
|
|
|
// changed.
|
|
|
|
//
|
2020-07-21 20:27:59 +00:00
|
|
|
// Type: UserID
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditInviteInviterID AuditLogChangeKey = "inviter_id"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditInviteMaxUses specifies the change to max number of times invite
|
|
|
|
// code can be used.
|
|
|
|
//
|
|
|
|
// Type: int
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditInviteMaxUses AuditLogChangeKey = "max_uses"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditInviteUses specifies the number of times invite code used changed.
|
|
|
|
//
|
|
|
|
// Type: int
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditInviteUses AuditLogChangeKey = "uses"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditInviteMaxAge specifies the how long invite code lasts
|
|
|
|
// changed.
|
|
|
|
//
|
|
|
|
// Type: Seconds
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditInviteMaxAge AuditLogChangeKey = "max_age"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditInviteTemporary specifies if an invite code is temporary/never
|
|
|
|
// expires.
|
|
|
|
//
|
|
|
|
// Type: bool
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditInviteTemporary AuditLogChangeKey = "temporary"
|
|
|
|
)
|
2020-05-08 00:09:45 +00:00
|
|
|
|
2020-05-08 03:01:44 +00:00
|
|
|
const (
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditUserDeaf specifies if the user was server deafened/undeafened.
|
|
|
|
//
|
|
|
|
// Type: bool
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditUserDeaf AuditLogChangeKey = "deaf"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditUserMute specifies if the user was server muted/unmuted.
|
|
|
|
//
|
|
|
|
// Type: bool
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditUserMute AuditLogChangeKey = "mute"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditUserNick specifies the new nickname of the user.
|
|
|
|
//
|
|
|
|
// Type: string
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditUserNick AuditLogChangeKey = "nick"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditUserAvatar specifies the hash of the new user avatar.
|
|
|
|
//
|
|
|
|
// Type: Hash
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditUserAvatarHash AuditLogChangeKey = "avatar_hash"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditAnyID specifies the ID of the changed entity - sometimes used in
|
|
|
|
// conjunction with other keys.
|
|
|
|
//
|
|
|
|
// Type: Snowflake
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditAnyID AuditLogChangeKey = "id"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditAnyType is the type of the entity created.
|
|
|
|
// Type ChannelType or string
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditAnyType AuditLogChangeKey = "type"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditIntegrationEnableEmoticons gets sent if the integration emoticons
|
|
|
|
// were enabled/disabled.
|
|
|
|
//
|
|
|
|
// Type: bool
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditIntegrationEnableEmoticons AuditLogChangeKey = "enable_emoticons"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditIntegrationExpireBehavior gets sent if the integration expiring
|
|
|
|
// subscriber behavior changed.
|
|
|
|
//
|
|
|
|
// Type: ExpireBehavior
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditIntegrationExpireBehavior AuditLogChangeKey = "expire_behavior"
|
2020-05-18 12:53:42 +00:00
|
|
|
// AuditIntegrationExpireGracePeriod gets sent if the integration expire
|
|
|
|
// grace period changed.
|
|
|
|
//
|
|
|
|
// Type: int
|
2020-05-08 03:01:44 +00:00
|
|
|
AuditIntegrationExpireGracePeriod AuditLogChangeKey = "expire_grace_period"
|
|
|
|
)
|