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.


3888
3889
3890
# File 'lib/discordrb/data.rb', line 3888

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.


3882
3883
3884
# File 'lib/discordrb/data.rb', line 3882

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.


3885
3886
3887
# File 'lib/discordrb/data.rb', line 3885

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.


4087
4088
4089
# File 'lib/discordrb/data.rb', line 4087

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


4095
4096
4097
# File 'lib/discordrb/data.rb', line 4095

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


4102
4103
4104
# File 'lib/discordrb/data.rb', line 4102

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