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
}.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.


74
75
76
# File 'lib/discordrb/data/audit_logs.rb', line 74

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.


68
69
70
# File 'lib/discordrb/data/audit_logs.rb', line 68

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.


71
72
73
# File 'lib/discordrb/data/audit_logs.rb', line 71

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.


276
277
278
# File 'lib/discordrb/data/audit_logs.rb', line 276

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:


284
285
286
# File 'lib/discordrb/data/audit_logs.rb', line 284

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:


291
292
293
# File 'lib/discordrb/data/audit_logs.rb', line 291

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