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.
265 266 267 |
# File 'lib/discorb/voice_state.rb', line 265 def privacy_level @privacy_level end |
Instance Attribute Details
#id ⇒ Discorb::Snowflake (readonly)
Returns The ID of the guild this voice state is for.
129 130 131 |
# File 'lib/discorb/voice_state.rb', line 129 def id @id end |
#privacy_level ⇒ :public, :guild_only (readonly)
Returns The privacy level of the stage instance.
133 134 135 |
# File 'lib/discorb/voice_state.rb', line 133 def privacy_level @privacy_level end |
#topic ⇒ String (readonly)
Returns The topic of the stage instance.
131 132 133 |
# File 'lib/discorb/voice_state.rb', line 131 def topic @topic end |
Instance Method Details
#channel ⇒ Object
169 170 171 |
# File 'lib/discorb/voice_state.rb', line 169 def channel @client.channels[@data[:channel_id]] end |
#delete(reason: nil) ⇒ Async::Task<void> Also known as: destroy, end
Deletes the stage instance.
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/discorb/voice_state.rb', line 232 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
173 174 175 |
# File 'lib/discorb/voice_state.rb', line 173 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.
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/discorb/voice_state.rb', line 200 def edit(topic: Discorb::Unset, privacy_level: Discorb::Unset, reason: nil) Async do payload = {} payload[:topic] = topic if topic != Discorb::Unset payload[:privacy_level] = 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
165 166 167 |
# File 'lib/discorb/voice_state.rb', line 165 def guild @client.guilds[@data[:guild_id]] end |
#guild_only? ⇒ Boolean
181 182 183 |
# File 'lib/discorb/voice_state.rb', line 181 def guild_only? @privacy_level == :guild_only end |
#inspect ⇒ Object
185 186 187 |
# File 'lib/discorb/voice_state.rb', line 185 def inspect "#<#{self.class} topic=#{@topic.inspect}>" end |
#public? ⇒ Boolean
177 178 179 |
# File 'lib/discorb/voice_state.rb', line 177 def public? @privacy_level == :public end |