class Discorb::StageChannel
Represents a stage channel.
Attributes
@return [Integer] The bitrate of the voice channel.
@!visibility private
@return [Integer] The user limit of the voice channel.
Public Class Methods
@!visibility private
Discorb::Channel::new
# File lib/discorb/channel.rb, line 710 def initialize(...) @stage_instances = Dictionary.new super(...) end
Public Instance Methods
Edit the stage channel. @macro async @macro http @macro edit
@param [String] name The name of the stage channel. @param [Integer] position The position of the stage channel. @param [Integer] bitrate The bitrate of the stage channel. @param [Symbol] rtc_region The region of the stage channel. @param [String] reason The reason of editing the stage channel.
@return [self] The edited stage channel.
# File lib/discorb/channel.rb, line 733 def edit(name: :unset, position: :unset, bitrate: :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[:rtc_region] = rtc_region if rtc_region != :unset @client.http.patch("/channels/#{@id}", payload, audit_log_reason: reason).wait self end end
Fetch a current stage instance. @macro async @macro http
@return [StageInstance] The current stage instance. @return [nil] If there is no current stage instance.
# File lib/discorb/channel.rb, line 773 def fetch_stage_instance Async do _resp, data = @client.http.get("/stage-instances/#{@id}").wait rescue Discorb::NotFoundError nil else StageInstance.new(@client, data) end end
# File lib/discorb/channel.rb, line 715 def stage_instance @stage_instances[0] end
Start a stage instance. @macro async @macro http
@param [String] topic The topic of the stage instance. @param [Boolean] public Whether the stage instance is public or not. @param [String] reason The reason of starting the stage instance.
@return [Discorb::StageInstance] The started stage instance.
# File lib/discorb/channel.rb, line 758 def start(topic, public: false, reason: nil) Async do _resp, data = @client.http.post("/stage-instances", { channel_id: @id, topic: topic, public: public ? 2 : 1 }, audit_log_reason: reason).wait StageInstance.new(@client, data) end end
Private Instance Methods
# File lib/discorb/channel.rb, line 785 def _set_data(data) @bitrate = data[:bitrate] @user_limit = data[:user_limit] @topic = data[:topic] @rtc_region = data[:rtc_region]&.to_sym super end