Class: Discorb::VoiceChannel
- Inherits:
-
GuildChannel
- Object
- DiscordModel
- Channel
- GuildChannel
- Discorb::VoiceChannel
- Includes:
- Connectable, Messageable
- Defined in:
- lib/discorb/channel/voice.rb
Overview
Represents a voice channel.
Instance Attribute Summary collapse
-
#bitrate -> Integer
readonly
The bitrate of the voice channel.
- #user_limit -> Integer? readonly
Attributes inherited from GuildChannel
#permission_overwrites, #position
Attributes inherited from Channel
Instance Method Summary collapse
-
#edit(name: Discorb::Unset, position: Discorb::Unset, bitrate: Discorb::Unset, user_limit: Discorb::Unset, rtc_region: Discorb::Unset, reason: nil) -> Async::Task<self>
(also: #modify)
Edit the voice channel.
- #members -> Object
- #voice_states -> Object
Methods included from Messageable
#delete_message, #edit_message, #fetch_message, #fetch_messages, #fetch_pins, #pin_message, #post, #typing, #unpin_message
Methods included from Connectable
Methods inherited from GuildChannel
#<=>, #==, #create_invite, #delete, #delete_permissions, #fetch_invites, #guild, #inspect, #mention, #move, #parent, #set_permissions, #to_s
Methods inherited from Channel
Methods inherited from DiscordModel
Instance Attribute Details
#bitrate -> Integer (readonly)
Returns The bitrate of the voice channel.
9 10 11 |
# File 'lib/discorb/channel/voice.rb', line 9 def bitrate @bitrate end |
#user_limit -> Integer? (readonly)
12 13 14 |
# File 'lib/discorb/channel/voice.rb', line 12 def user_limit @user_limit end |
Instance Method Details
#edit(name: Discorb::Unset, position: Discorb::Unset, bitrate: Discorb::Unset, user_limit: Discorb::Unset, rtc_region: Discorb::Unset, reason: nil) -> Async::Task<self> 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
.
Edit the voice channel.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/discorb/channel/voice.rb', line 37 def edit( name: Discorb::Unset, position: Discorb::Unset, bitrate: Discorb::Unset, user_limit: Discorb::Unset, rtc_region: Discorb::Unset, reason: nil ) Async do payload = {} payload[:name] = name if name != Discorb::Unset payload[:position] = position if position != Discorb::Unset payload[:bitrate] = bitrate if bitrate != Discorb::Unset payload[:user_limit] = user_limit if user_limit != Discorb::Unset payload[:rtc_region] = rtc_region if rtc_region != Discorb::Unset @client .http .request( Route.new("/channels/#{@id}", "//channels/:channel_id", :patch), payload, audit_log_reason: reason ) .wait self end end |
#members -> Object
71 72 73 |
# File 'lib/discorb/channel/voice.rb', line 71 def members voice_states.map(&:member) end |
#voice_states -> Object
67 68 69 |
# File 'lib/discorb/channel/voice.rb', line 67 def voice_states guild.voice_states.select { |state| state.channel&.id == @id } end |