class Discordrb::AuditLogs::Change
A change in a audit log entry.
Attributes
@return [String] the key that was changed. @note You should check with the Discord API
Documentation on what key gives out what value.
@return [String, Integer
, true, false, Permissions
, Overwrite
, nil] the value that was changed to.
@return [String, Integer
, true, false, Permissions
, Overwrite
, nil] the value that was changed to.
@return [String, Integer
, true, false, Permissions
, Overwrite
, nil] the value that was changed from.
@return [String, Integer
, true, false, Permissions
, Overwrite
, nil] the value that was changed from.
Public Class Methods
@!visibility private
# File lib/discordrb/data/audit_logs.rb, line 211 def initialize(data, server, bot, logs) @key = data['key'] @old = data['old_value'] @new = data['new_value'] @server = server @bot = bot @logs = logs @old = Permissions.new(@old) if @old && @key == 'permissions' @new = Permissions.new(@new) if @new && @key == 'permissions' @old = @old.map { |o| Overwrite.new(o['id'], type: o['type'], allow: o['allow'], deny: o['deny']) } if @old && @key == 'permission_overwrites' @new = @new.map { |o| Overwrite.new(o['id'], type: o['type'], allow: o['allow'], deny: o['deny']) } if @new && @key == 'permission_overwrites' end
Public Instance Methods
@return [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`.
# File lib/discordrb/data/audit_logs.rb, line 242 def new_afk_channel @bot.channel(@new, @server) if @new && @key == 'afk_channel_id' end
@return [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`.
# File lib/discordrb/data/audit_logs.rb, line 252 def new_owner @server.member(@new) || @bot.user(@new) || @logs.user(@new) if @new && @key == 'owner_id' end
@return [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`.
# File lib/discordrb/data/audit_logs.rb, line 232 def new_widget_channel @bot.channel(@new, @server) if @new && @key == 'widget_channel_id' end
@return [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`.
# File lib/discordrb/data/audit_logs.rb, line 237 def old_afk_channel @bot.channel(@old, @server) if @old && @key == 'afk_channel_id' end
@return [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`.
# File lib/discordrb/data/audit_logs.rb, line 247 def old_owner @server.member(@old) || @bot.user(@old) || @logs.user(@old) if @old && @key == 'owner_id' end
@return [Channel, nil] the channel that was previously used in the server widget. Only present if the key for this change is ‘widget_channel_id`.
# File lib/discordrb/data/audit_logs.rb, line 227 def old_widget_channel @bot.channel(@old, @server) if @old && @key == 'widget_channel_id' end