Class: Discordrb::AuditLogs::Change

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

Overview

A change in a audit log entry.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyString (readonly)

Note:

You should check with the Discord API Documentation on what key gives out what value.

Returns the key that was changed.

Returns:

  • (String)

    the key that was changed.



281
282
283
# File 'lib/discordrb/data/audit_logs.rb', line 281

def key
  @key
end

#newString, ... (readonly) Also known as: new_value

Returns the value that was changed to.

Returns:



288
289
290
# File 'lib/discordrb/data/audit_logs.rb', line 288

def new
  @new
end

#oldString, ... (readonly) Also known as: old_value

Returns the value that was changed from.

Returns:



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

def old
  @old
end

Instance Method Details

#new_afk_channelChannel?

Returns the channel that is used in the server as an AFK channel prior to this change. Only present if the key for this change is afk_channel_id.

Returns:

  • (Channel, nil)

    the channel that is used in the server as an AFK channel prior to this change. Only present if the key for this change is afk_channel_id.



323
324
325
# File 'lib/discordrb/data/audit_logs.rb', line 323

def new_afk_channel
  @bot.channel(@new, @server) if @new && @key == 'afk_channel_id'
end

#new_ownerMember, ...

Returns the member that is now the owner of the server prior to this change. Only present if the key for this change is owner_id.

Returns:

  • (Member, User, nil)

    the member that is now the owner of the server prior to this change. Only present if the key for this change is owner_id.



333
334
335
# File 'lib/discordrb/data/audit_logs.rb', line 333

def new_owner
  @server.member(@new) || @bot.user(@new) || @logs&.user(@new) if @new && @key == 'owner_id'
end

#new_widget_channelChannel?

Returns the channel that is used in the server widget prior to this change. Only present if the key for this change is widget_channel_id.

Returns:

  • (Channel, nil)

    the channel that is used in the server widget prior to this change. Only present if the key for this change is widget_channel_id.



313
314
315
# File 'lib/discordrb/data/audit_logs.rb', line 313

def new_widget_channel
  @bot.channel(@new, @server) if @new && @key == 'widget_channel_id'
end

#old_afk_channelChannel?

Returns the channel that was previously used in the server as an AFK channel. Only present if the key for this change is afk_channel_id.

Returns:

  • (Channel, nil)

    the channel that was previously used in the server as an AFK channel. Only present if the key for this change is afk_channel_id.



318
319
320
# File 'lib/discordrb/data/audit_logs.rb', line 318

def old_afk_channel
  @bot.channel(@old, @server) if @old && @key == 'afk_channel_id'
end

#old_ownerMember, ...

Returns the member that used to be the owner of the server. Only present if the for key for this change is owner_id.

Returns:

  • (Member, User, nil)

    the member that used to be the owner of the server. Only present if the for key for this change is owner_id.



328
329
330
# File 'lib/discordrb/data/audit_logs.rb', line 328

def old_owner
  @server.member(@old) || @bot.user(@old) || @logs&.user(@old) if @old && @key == 'owner_id'
end

#old_widget_channelChannel?

Returns the channel that was previously used in the server widget. Only present if the key for this change is widget_channel_id.

Returns:

  • (Channel, nil)

    the channel that was previously used in the server widget. Only present if the key for this change is widget_channel_id.



308
309
310
# File 'lib/discordrb/data/audit_logs.rb', line 308

def old_widget_channel
  @bot.channel(@old, @server) if @old && @key == 'widget_channel_id'
end