Class: Discordrb::PrimaryServer
- Inherits:
-
Object
- Object
- Discordrb::PrimaryServer
- Defined in:
- lib/discordrb/data/primary_server.rb
Overview
A server tag that a user has chosen to display on their profile.
Instance Attribute Summary collapse
-
#badge_id ⇒ String
readonly
The ID of the server tag's badge.
-
#enabled ⇒ Boolean
(also: #enabled?)
readonly
If the user is displaying the primary server's tag.
-
#name ⇒ String
(also: #text)
readonly
The text of the primary server's tag.
-
#server_id ⇒ Integer
readonly
The ID of the server this primary server is for.
Instance Method Summary collapse
-
#==(other) ⇒ Object
(also: #eql?)
Comparison based off of server ID.
-
#badge_url(format = 'webp') ⇒ String
Utility method to get a server tag's badge URL.
-
#server ⇒ Server
Get the server associated with this primary server.
Instance Attribute Details
#badge_id ⇒ String (readonly)
Returns the ID of the server tag's badge. can be used to generate a badge URL.
19 20 21 |
# File 'lib/discordrb/data/primary_server.rb', line 19 def badge_id @badge_id end |
#enabled ⇒ Boolean (readonly) Also known as: enabled?
Returns if the user is displaying the primary server's tag.
10 11 12 |
# File 'lib/discordrb/data/primary_server.rb', line 10 def enabled @enabled end |
#name ⇒ String (readonly) Also known as: text
Returns the text of the primary server's tag. Limited to four characters.
14 15 16 |
# File 'lib/discordrb/data/primary_server.rb', line 14 def name @name end |
#server_id ⇒ Integer (readonly)
Returns the ID of the server this primary server is for.
7 8 9 |
# File 'lib/discordrb/data/primary_server.rb', line 7 def server_id @server_id end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
Comparison based off of server ID.
45 46 47 48 49 |
# File 'lib/discordrb/data/primary_server.rb', line 45 def ==(other) return false unless other.is_a?(PrimaryServer) Discordrb.id_compare(other.server_id, @server_id) end |
#badge_url(format = 'webp') ⇒ String
Utility method to get a server tag's badge URL.
40 41 42 |
# File 'lib/discordrb/data/primary_server.rb', line 40 def badge_url(format = 'webp') API.server_tag_badge_url(@server_id, @badge_id, format) end |
#server ⇒ Server
Get the server associated with this primary server.
33 34 35 |
# File 'lib/discordrb/data/primary_server.rb', line 33 def server @bot.server(@server_id) end |