Class: Discorb::AuditLog::Entry

Inherits:
DiscordModel show all
Defined in:
lib/discorb/audit_logs.rb

Overview

Represents an entry in an audit log.

Defined Under Namespace

Classes: Change, Changes

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?

Class Attribute Details

.converts -> Object (readonly)

Returns the value of attribute converts.



264
265
266
# File 'lib/discorb/audit_logs.rb', line 264

def converts
  @converts
end

.events -> Object (readonly)

Returns the value of attribute events.



264
265
266
# File 'lib/discorb/audit_logs.rb', line 264

def events
  @events
end

Instance Attribute Details

#changes -> Discorb::AuditLog::Entry::Changes (readonly)

Returns The changes in this entry.

Returns:



120
121
122
# File 'lib/discorb/audit_logs.rb', line 120

def changes
  @changes
end

#id -> Discorb::Snowflake (readonly)

Returns The ID of the entry.

Returns:



62
63
64
# File 'lib/discorb/audit_logs.rb', line 62

def id
  @id
end

#options -> Hash{Symbol => Object} (readonly)

Note:

You can use dot notation to access the data.

Returns The optional data for this entry.

Returns:

  • (Hash{Symbol => Object})

    The optional data for this entry.



126
127
128
# File 'lib/discorb/audit_logs.rb', line 126

def options
  @options
end

#target -> Discorb::Channel, ... (readonly)

Returns The target of the entry.



123
124
125
# File 'lib/discorb/audit_logs.rb', line 123

def target
  @target
end

#target_id -> Discorb::Snowflake (readonly)

Returns The ID of the target of the action.

Returns:



66
67
68
# File 'lib/discorb/audit_logs.rb', line 66

def target_id
  @target_id
end

#type -> Symbol (readonly)

These symbols will be used:

  • :guild_update
  • :channel_create
  • :channel_update
  • :channel_delete
  • :channel_overwrite_create
  • :channel_overwrite_update
  • :channel_overwrite_delete
  • :member_kick
  • :member_prune
  • :member_ban_add
  • :member_ban_remove
  • :member_update
  • :member_role_update
  • :member_move
  • :member_disconnect
  • :bot_add
  • :role_create
  • :role_update
  • :role_delete
  • :invite_create
  • :invite_update
  • :invite_delete
  • :webhook_create
  • :webhook_update
  • :webhook_delete
  • :emoji_create
  • :emoji_update
  • :emoji_delete
  • :message_delete
  • :message_bulk_delete
  • :message_pin
  • :message_unpin
  • :integration_create
  • :integration_update
  • :integration_delete
  • :stage_instance_create
  • :stage_instance_update
  • :stage_instance_delete
  • :sticker_create
  • :sticker_update
  • :sticker_delete
  • :guild_scheduled_event_create
  • :guild_scheduled_event_update
  • :guild_scheduled_event_delete
  • :thread_create
  • :thread_update
  • :thread_delete
  • :application_command_permission_update`

Returns:

  • (Symbol)

    The type of the entry.



118
119
120
# File 'lib/discorb/audit_logs.rb', line 118

def type
  @type
end

#user -> Discorb::User (readonly)

Returns The user who performed the action.

Returns:



# File 'lib/discorb/audit_logs.rb', line 128

#user_id -> Discorb::Snowflake (readonly)

Returns The ID of the user who performed the action.

Returns:



64
65
66
# File 'lib/discorb/audit_logs.rb', line 64

def user_id
  @user_id
end

Instance Method Details

#[](key) -> Discorb::AuditLog::Entry::Change?

Get a change with the given key.

Parameters:

  • key (Symbol)

    The key to get.

Returns:



255
256
257
# File 'lib/discorb/audit_logs.rb', line 255

def [](key)
  @changes[key]
end

#inspect -> Object



259
260
261
# File 'lib/discorb/audit_logs.rb', line 259

def inspect
  "#<#{self.class} #{@changes&.data&.length || "No"} changes>"
end