Class: Discordrb::AuditLogs

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data/audit_logs.rb

Overview

A server's audit logs

Defined Under Namespace

Classes: Change, Entry, RoleChange

Constant Summary collapse

ACTIONS =

The numbers associated with the type of action.

{
  1 => :server_update,
  10 => :channel_create,
  11 => :channel_update,
  12 => :channel_delete,
  13 => :channel_overwrite_create,
  14 => :channel_overwrite_update,
  15 => :channel_overwrite_delete,
  20 => :member_kick,
  21 => :member_prune,
  22 => :member_ban_add,
  23 => :member_ban_remove,
  24 => :member_update,
  25 => :member_role_update,
  26 => :member_move,
  27 => :member_disconnect,
  28 => :bot_add,
  30 => :role_create,
  31 => :role_update,
  32 => :role_delete,
  40 => :invite_create,
  41 => :invite_update,
  42 => :invite_delete,
  50 => :webhook_create,
  51 => :webhook_update,
  52 => :webhook_delete,
  60 => :emoji_create,
  61 => :emoji_update,
  62 => :emoji_delete,
  # 70
  # 71
  72 => :message_delete,
  73 => :message_bulk_delete,
  74 => :message_pin,
  75 => :message_unpin,
  80 => :integration_create,
  81 => :integration_update,
  82 => :integration_delete,
  83 => :stage_instance_create,
  84 => :stage_instance_update,
  85 => :stage_instance_delete,
  90 => :sticker_create,
  91 => :sticker_update,
  92 => :sticker_delete,
  100 => :scheduled_event_create,
  101 => :scheduled_event_update,
  102 => :scheduled_event_delete,
  110 => :thread_create,
  111 => :thread_update,
  112 => :thread_delete,
  121 => :application_command_permission_update,
  130 => :soundboard_sound_create,
  131 => :soundboard_sound_update,
  132 => :soundboard_sound_delete,
  140 => :auto_moderation_rule_create,
  141 => :auto_moderation_rule_update,
  142 => :auto_moderation_rule_delete,
  143 => :auto_moderation_block_message,
  144 => :auto_moderation_flag_to_channel,
  145 => :auto_moderation_user_communication_disabled,
  146 => :auto_moderation_quarantine_user,
  150 => :creator_monetization_request_created,
  151 => :creator_monetization_terms_accepted,
  163 => :onboarding_prompt_create,
  164 => :onboarding_prompt_update,
  165 => :onboarding_prompt_delete,
  166 => :onboarding_create,
  167 => :onboarding_update,
  190 => :home_settings_create,
  191 => :home_settings_update
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entriesArray<Entry> (readonly)

Returns the entries listed in the audit logs.

Returns:

  • (Array<Entry>)

    the entries listed in the audit logs.



117
118
119
# File 'lib/discordrb/data/audit_logs.rb', line 117

def entries
  @entries
end

#usersHash<String => User> (readonly)

Returns the users included in the audit logs.

Returns:

  • (Hash<String => User>)

    the users included in the audit logs.



111
112
113
# File 'lib/discordrb/data/audit_logs.rb', line 111

def users
  @users
end

#webhooksHash<String => Webhook> (readonly)

Returns the webhooks included in the audit logs.

Returns:

  • (Hash<String => Webhook>)

    the webhooks included in the audit logs.



114
115
116
# File 'lib/discordrb/data/audit_logs.rb', line 114

def webhooks
  @webhooks
end

Instance Method Details

#latestEntry Also known as: first

Returns the latest entry in the audit logs.

Returns:

  • (Entry)

    the latest entry in the audit logs.



357
358
359
# File 'lib/discordrb/data/audit_logs.rb', line 357

def latest
  @entries.first
end

#user(id) ⇒ Object

Note:

This only uses data given by the audit logs request

Gets a user in the audit logs data based on user ID

Parameters:



365
366
367
# File 'lib/discordrb/data/audit_logs.rb', line 365

def user(id)
  @users[id.resolve_id]
end

#webhook(id) ⇒ Object

Note:

This only uses data given by the audit logs request

Gets a webhook in the audit logs data based on webhook ID

Parameters:



372
373
374
# File 'lib/discordrb/data/audit_logs.rb', line 372

def webhook(id)
  @webhooks[id.resolve_id]
end