Class: Discorb::StageInstance
- Inherits:
-
DiscordModel
- Object
- DiscordModel
- Discorb::StageInstance
- Defined in:
- lib/discorb/voice_state.rb
Overview
Represents a stage instance of a voice state.
Class Attribute Summary collapse
-
.privacy_level -> Object
readonly
Returns the value of attribute privacy_level.
Instance Attribute Summary collapse
-
#id -> Discorb::Snowflake
readonly
The ID of the guild this voice state is for.
-
#privacy_level -> :public, :guild_only
readonly
The privacy level of the stage instance.
-
#topic -> String
readonly
The topic of the stage instance.
Instance Method Summary collapse
- #channel -> Object
-
#delete!(reason: nil) -> Async::Task<void>
(also: #destroy!, #end!)
Deletes the stage instance.
- #discoverable? -> Boolean
-
#edit(topic: Discorb::Unset, privacy_level: Discorb::Unset, reason: nil) -> Async::Task<void>
(also: #modify)
Edits the stage instance.
- #guild -> Object
- #guild_only? -> Boolean
- #inspect -> Object
- #public? -> Boolean
Methods inherited from DiscordModel
Class Attribute Details
.privacy_level -> Object (readonly)
Returns the value of attribute privacy_level.
224 225 226 |
# File 'lib/discorb/voice_state.rb', line 224 def privacy_level @privacy_level end |
Instance Attribute Details
#id -> Discorb::Snowflake (readonly)
Returns The ID of the guild this voice state is for.
114 115 116 |
# File 'lib/discorb/voice_state.rb', line 114 def id @id end |
#privacy_level -> :public, :guild_only (readonly)
Returns The privacy level of the stage instance.
118 119 120 |
# File 'lib/discorb/voice_state.rb', line 118 def privacy_level @privacy_level end |
#topic -> String (readonly)
Returns The topic of the stage instance.
116 117 118 |
# File 'lib/discorb/voice_state.rb', line 116 def topic @topic end |
Instance Method Details
#channel -> Object
150 151 152 |
# File 'lib/discorb/voice_state.rb', line 150 def channel @client.channels[@data[:channel_id]] end |
#delete!(reason: nil) -> Async::Task<void> Also known as: destroy!, end!
Deletes the stage instance.
202 203 204 205 206 207 |
# File 'lib/discorb/voice_state.rb', line 202 def delete!(reason: nil) Async do @client.http.request(Route.new("/stage-instances/#{@channel_id}", "//stage-instances/:stage_instance_id", :delete), audit_log_reason: reason).wait self end end |
#discoverable? -> Boolean
154 155 156 |
# File 'lib/discorb/voice_state.rb', line 154 def discoverable? !@discoverable_disabled end |
#edit(topic: Discorb::Unset, privacy_level: Discorb::Unset, reason: nil) -> Async::Task<void> Also known as: modify
Note:
The arguments of this method are defaultly set to Discorb::Unset
. Specify value to set the value, if not don't specify or specify Discorb::Unset
.
Edits the stage instance.
181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/discorb/voice_state.rb', line 181 def edit(topic: Discorb::Unset, privacy_level: Discorb::Unset, reason: nil) Async do payload = {} payload[:topic] = topic if topic != Discorb::Unset payload[:privacy_level] = self.class.privacy_level.key(privacy_level) if privacy_level != Discorb::Unset @client.http.request( Route.new("/stage-instances/#{@channel_id}", "//stage-instances/:channel_id", :patch), payload, audit_log_reason: reason, ).wait self end end |
#guild -> Object
146 147 148 |
# File 'lib/discorb/voice_state.rb', line 146 def guild @client.guilds[@data[:guild_id]] end |
#guild_only? -> Boolean
162 163 164 |
# File 'lib/discorb/voice_state.rb', line 162 def guild_only? @privacy_level == :guild_only end |
#inspect -> Object
166 167 168 |
# File 'lib/discorb/voice_state.rb', line 166 def inspect "#<#{self.class} topic=#{@topic.inspect}>" end |
#public? -> Boolean
158 159 160 |
# File 'lib/discorb/voice_state.rb', line 158 def public? @privacy_level == :public end |