Class: Discorb::VoiceChannel

Inherits:
GuildChannel show all
Defined in:
lib/discorb/channel.rb

Overview

TODO:

Implement connecting to voice channel.

Represents a voice channel.

Instance Attribute Summary collapse

Attributes inherited from GuildChannel

#permission_overwrites, #position

Attributes inherited from Channel

#id, #name

Instance Method Summary collapse

Methods inherited from GuildChannel

#<=>, #==, #delete!, #guild, #inspect, #mention, #move, #parent, #to_s

Methods inherited from Channel

#==, #inspect, #type

Methods inherited from DiscordModel

#==, #eql?, #hash

Instance Attribute Details

#bitrate -> Integer (readonly)

Returns The bitrate of the voice channel.

Returns:

  • (Integer)

    The bitrate of the voice channel.



643
644
645
# File 'lib/discorb/channel.rb', line 643

def bitrate
  @bitrate
end

#user_limit -> Integer? (readonly)

Returns:

  • (Integer)

    The user limit of the voice channel.

  • (nil)

    If the user limit is not set.



646
647
648
# File 'lib/discorb/channel.rb', line 646

def user_limit
  @user_limit
end

Instance Method Details

#edit(name: :unset, position: :unset, bitrate: :unset, user_limit: :unset, rtc_region: :unset, reason: nil) -> self Also known as: modify

Note:

This is an asynchronous method, it will return a Async::Task object. Use Async::Task#wait to get the result.

Note:

This method calls HTTP request.

Note:

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 voice channel.

Parameters:

  • name (String) (defaults to: :unset)

    The name of the voice channel.

  • position (Integer) (defaults to: :unset)

    The position of the voice channel.

  • bitrate (Integer) (defaults to: :unset)

    The bitrate of the voice channel.

  • user_limit (Integer) (defaults to: :unset)

    The user limit of the voice channel.

  • rtc_region (Symbol) (defaults to: :unset)

    The region of the voice channel.

  • reason (String) (defaults to: nil)

    The reason of editing the voice channel.

Returns:

  • (self)

    The edited voice channel.

Raises:



664
665
666
667
668
669
670
671
672
673
674
675
676
# File 'lib/discorb/channel.rb', line 664

def edit(name: :unset, position: :unset, bitrate: :unset, user_limit: :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[:user_limit] = user_limit if user_limit != :unset
    payload[:rtc_region] = rtc_region if rtc_region != :unset

    @client.internet.patch("/channels/#{@id}", payload, audit_log_reason: reason).wait
    self
  end
end