class Discorb::AuditLog

Represents a Discord audit log.

Attributes

entries[R]

@return [Array<Discorb::AuditLog::Entry>] The entries in this audit log.

threads[R]

@return [Array<Discorb::ThreadChannel>] The threads in this audit log.

users[R]

@return [Array<Discorb::User>] The users in this audit log.

webhooks[R]

@return [Array<Discorb::Webhook>] The webhooks in this audit log.

Public Class Methods

new(client, data, guild) click to toggle source

@!visibility private

# File lib/discorb/audit_logs.rb, line 18
def initialize(client, data, guild)
  @client = client
  @guild = guild
  @webhooks = data[:webhooks].map { |webhook| Webhook.new([@client, webhook]) }
  @users = data[:users].map { |user| client.users[user[:id]] || User.new(@client, user) }
  @threads = data[:threads].map { |thread| client.channels[thread[:id]] || Channel.make_channel(@client, thread, no_cache: true) }
  @entries = data[:audit_log_entries].map { |entry| AuditLog::Entry.new(@client, entry, guild.id) }
end

Public Instance Methods

[](index) click to toggle source

Gets an entry from entries.

@param [Integer] index The index of the entry.

@return [Discorb::AuditLog::Entry] The entry. @return [nil] If the index is out of range.

# File lib/discorb/audit_logs.rb, line 35
def [](index)
  @entries[index]
end