Class: Rubycord::VoiceRegion

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycord/data/voice_region.rb

Overview

Voice regions are the locations of servers that handle voice communication in Discord

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ VoiceRegion

Returns a new instance of VoiceRegion.



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rubycord/data/voice_region.rb', line 29

def initialize(data)
  @id = data["id"]

  @name = data["name"]

  @sample_hostname = data["sample_hostname"]
  @sample_port = data["sample_port"]

  @vip = data["vip"]
  @optimal = data["optimal"]
  @deprecated = data["deprecated"]
  @custom = data["custom"]
end

Instance Attribute Details

#customtrue, false (readonly)

Returns whether this is a custom voice region (used for events/etc).

Returns:

  • (true, false)

    whether this is a custom voice region (used for events/etc)



27
28
29
# File 'lib/rubycord/data/voice_region.rb', line 27

def custom
  @custom
end

#deprecatedtrue, false (readonly)

Returns whether this is a deprecated voice region (avoid switching to these).

Returns:

  • (true, false)

    whether this is a deprecated voice region (avoid switching to these)



24
25
26
# File 'lib/rubycord/data/voice_region.rb', line 24

def deprecated
  @deprecated
end

#idString (readonly) Also known as: to_s

Returns unique ID for the region.

Returns:

  • (String)

    unique ID for the region



5
6
7
# File 'lib/rubycord/data/voice_region.rb', line 5

def id
  @id
end

#nameString (readonly)

Returns name of the region.

Returns:

  • (String)

    name of the region



9
10
11
# File 'lib/rubycord/data/voice_region.rb', line 9

def name
  @name
end

#optimaltrue, false (readonly)

Returns if this voice server is the closest to the client.

Returns:

  • (true, false)

    if this voice server is the closest to the client



21
22
23
# File 'lib/rubycord/data/voice_region.rb', line 21

def optimal
  @optimal
end

#sample_hostnameString (readonly)

Returns an example hostname for the region.

Returns:

  • (String)

    an example hostname for the region



12
13
14
# File 'lib/rubycord/data/voice_region.rb', line 12

def sample_hostname
  @sample_hostname
end

#sample_portInteger (readonly)

Returns an example port for the region.

Returns:

  • (Integer)

    an example port for the region



15
16
17
# File 'lib/rubycord/data/voice_region.rb', line 15

def sample_port
  @sample_port
end

#viptrue, false (readonly)

Returns if this is a VIP-only server.

Returns:

  • (true, false)

    if this is a VIP-only server



18
19
20
# File 'lib/rubycord/data/voice_region.rb', line 18

def vip
  @vip
end