class Discorb::VoiceChannel

Represents a voice channel.

Attributes

bitrate[R]

@return [Integer] The bitrate of the voice channel.

user_limit[R]

@return [Integer] The user limit of the voice channel. @return [nil] If the user limit is not set.

Public Instance Methods

edit(name: :unset, position: :unset, bitrate: :unset, user_limit: :unset, rtc_region: :unset, reason: nil) click to toggle source

Edit the voice channel. @macro async @macro http @macro edit

@param [String] name The name of the voice channel. @param [Integer] position The position of the voice channel. @param [Integer] bitrate The bitrate of the voice channel. @param [Integer] user_limit The user limit of the voice channel. @param [Symbol] rtc_region The region of the voice channel. @param [String] reason The reason of editing the voice channel.

@return [self] The edited voice channel.

# File lib/discorb/channel.rb, line 665
def edit(name: :unset, position: :unset, bitrate: :unset, user_limit: :unset, rtc_region: :unset, reason: nil)
  Async do
    payload = {}
    payload[:name] = name if name != :unset
    payload[:position] = position if position != :unset
    payload[:bitrate] = bitrate if bitrate != :unset
    payload[:user_limit] = user_limit if user_limit != :unset
    payload[:rtc_region] = rtc_region if rtc_region != :unset

    @client.http.patch("/channels/#{@id}", payload, audit_log_reason: reason).wait
    self
  end
end
Also aliased as: modify
modify(name: :unset, position: :unset, bitrate: :unset, user_limit: :unset, rtc_region: :unset, reason: nil)
Alias for: edit

Private Instance Methods

_set_data(data) click to toggle source
Calls superclass method Discorb::GuildChannel#_set_data
# File lib/discorb/channel.rb, line 683
def _set_data(data)
  @bitrate = data[:bitrate]
  @user_limit = (data[:user_limit]).zero? ? nil : data[:user_limit]
  @rtc_region = data[:rtc_region]&.to_sym
  @video_quality_mode = data[:video_quality_mode] == 1 ? :auto : :full
  super
end