Class: Discorb::StageChannel
- Inherits:
-
GuildChannel
- Object
- DiscordModel
- Channel
- GuildChannel
- Discorb::StageChannel
- Includes:
- Connectable
- Defined in:
- lib/discorb/channel.rb
Overview
Represents a stage channel.
Instance Attribute Summary collapse
-
#bitrate -> Integer
readonly
The bitrate of the voice channel.
-
#user_limit -> Integer
readonly
The user limit of the voice channel.
Attributes inherited from GuildChannel
#permission_overwrites, #position
Attributes inherited from Channel
Instance Method Summary collapse
-
#edit(name: :unset, position: :unset, bitrate: :unset, rtc_region: :unset, reason: nil) -> Async::Task<self>
(also: #modify)
Edit the stage channel.
-
#fetch_stage_instance -> Async::Task<StageInstance>, Async::Task<nil>
Fetch a current stage instance.
- #stage_instance -> Object
-
#start(topic, public: false, reason: nil) -> Async::Task<Discorb::StageInstance>
Start a stage instance.
Methods included from Connectable
Methods inherited from GuildChannel
#<=>, #==, #delete!, #guild, #inspect, #mention, #move, #parent, #to_s
Methods inherited from Channel
Methods inherited from DiscordModel
Instance Attribute Details
#bitrate -> Integer (readonly)
Returns The bitrate of the voice channel.
655 656 657 |
# File 'lib/discorb/channel.rb', line 655 def bitrate @bitrate end |
#user_limit -> Integer (readonly)
Returns The user limit of the voice channel.
657 658 659 |
# File 'lib/discorb/channel.rb', line 657 def user_limit @user_limit end |
Instance Method Details
#edit(name: :unset, position: :unset, bitrate: :unset, rtc_region: :unset, reason: nil) -> Async::Task<self> Also known as: modify
This is an asynchronous method, it will return a Async::Task
object. Use Async::Task#wait
to get the result.
This method calls HTTP request.
The arguments of this method are defaultly set to :unset
. Specify value to set the value, if not don't specify or specify :unset
.
Edit the stage channel.
691 692 693 694 695 696 697 698 699 700 701 |
# File 'lib/discorb/channel.rb', line 691 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_stage_instance -> Async::Task<StageInstance>, Async::Task<nil>
This is an asynchronous method, it will return a Async::Task
object. Use Async::Task#wait
to get the result.
This method calls HTTP request.
Fetch a current stage instance.
731 732 733 734 735 736 737 738 739 |
# File 'lib/discorb/channel.rb', line 731 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 |
#stage_instance -> Object
673 674 675 |
# File 'lib/discorb/channel.rb', line 673 def stage_instance @stage_instances[0] end |
#start(topic, public: false, reason: nil) -> Async::Task<Discorb::StageInstance>
This is an asynchronous method, it will return a Async::Task
object. Use Async::Task#wait
to get the result.
This method calls HTTP request.
Start a stage instance.
716 717 718 719 720 721 |
# File 'lib/discorb/channel.rb', line 716 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 |