Class: Discordrb::AuditLogs

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data.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,
  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
}.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.



3921
3922
3923
# File 'lib/discordrb/data.rb', line 3921

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.



3915
3916
3917
# File 'lib/discordrb/data.rb', line 3915

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.



3918
3919
3920
# File 'lib/discordrb/data.rb', line 3918

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.



4122
4123
4124
# File 'lib/discordrb/data.rb', line 4122

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:

  • id (#resolve_id)

    The user ID to look for



4130
4131
4132
# File 'lib/discordrb/data.rb', line 4130

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:

  • id (#resolve_id)

    The webhook ID to look for



4137
4138
4139
# File 'lib/discordrb/data.rb', line 4137

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