Class: ListCordRB::Bot
- Inherits:
-
Object
- Object
- ListCordRB::Bot
- Defined in:
- lib/listcordrb/bot.rb
Overview
Find information about bots.
Instance Attribute Summary collapse
-
#data ⇒ Object
(also: #to_s)
readonly
Data in raw json form.
Instance Method Summary collapse
-
#avatar ⇒ String
The avatar hash of the bot’s avatar.
-
#avatar_img ⇒ String
Get’s the bot’s avatar as an img, ready to be used in image linking.
-
#certified? ⇒ true, false
The certified status of the bot.
-
#description ⇒ String
The description of the bot.
-
#discriminator ⇒ Integer
(also: #discrim, #tag)
The discriminator of the bot.
-
#distinct ⇒ String
Returns the bot’s distinct, which is the Username and Discriminator.
-
#error ⇒ String?
Return the error message if there is one, nil otherwise.
-
#error? ⇒ true, false
Return true if there is an error, false otherwise.
-
#id ⇒ Integer
(also: #clientid)
Get the bot’s ID.
-
#initialize(id) ⇒ Bot
constructor
Initialize the bot.
-
#invite ⇒ String
The custom bot invite url of the bot.
-
#invites ⇒ Integer
The amount of times the invite button has been clicked for the bot.
-
#online? ⇒ true, false
(also: #online)
Is the bot online or not?.
-
#owners ⇒ Array<String>
The owners of the bot.
-
#prefix ⇒ Integer
Get the bot’s prefix.
-
#premium? ⇒ true, false
(also: #premium)
The premium status of the bot.
-
#servers ⇒ Integer
(also: #guilds, #guild, #server)
Get the bot’s server count.
-
#support ⇒ String
The support server invite code of the bot.
-
#support_link ⇒ String
The bot’s support server link, ready for clicking.
-
#username ⇒ String
The username of the bot.
-
#verified? ⇒ true, false
The verified status of the bot.
-
#votes ⇒ Integer
The amount of upvotes the bot has.
-
#website ⇒ String
The website url of the bot.
Constructor Details
#initialize(id) ⇒ Bot
Initialize the bot
5 6 7 8 |
# File 'lib/listcordrb/bot.rb', line 5 def initialize(id) url = "https://listcord.com/api/bot/#{id}" @data = JSON.parse(RestClient.get(url)) end |
Instance Attribute Details
#data ⇒ Object (readonly) Also known as: to_s
Returns data in raw json form.
11 12 13 |
# File 'lib/listcordrb/bot.rb', line 11 def data @data end |
Instance Method Details
#avatar ⇒ String
The avatar hash of the bot’s avatar.
55 56 57 |
# File 'lib/listcordrb/bot.rb', line 55 def avatar @data['avatar'] end |
#avatar_img ⇒ String
Get’s the bot’s avatar as an img, ready to be used in image linking.
61 62 63 |
# File 'lib/listcordrb/bot.rb', line 61 def avatar_img "https://cdn.discordapp.com/avatars/#{id}/#{avatar}.webp?size=1024" end |
#certified? ⇒ true, false
The certified status of the bot.
128 129 130 |
# File 'lib/listcordrb/bot.rb', line 128 def certified? @data['certified'] end |
#description ⇒ String
The description of the bot.
41 42 43 |
# File 'lib/listcordrb/bot.rb', line 41 def description @data['description'] end |
#discriminator ⇒ Integer Also known as: discrim, tag
The discriminator of the bot.
67 68 69 |
# File 'lib/listcordrb/bot.rb', line 67 def discriminator @data['discriminator'].to_i end |
#distinct ⇒ String
Returns the bot’s distinct, which is the Username and Discriminator.
82 83 84 |
# File 'lib/listcordrb/bot.rb', line 82 def distinct "#{username}\##{tag}" end |
#error ⇒ String?
Return the error message if there is one, nil otherwise.
17 18 19 |
# File 'lib/listcordrb/bot.rb', line 17 def error @data['message'] end |
#error? ⇒ true, false
Return true if there is an error, false otherwise.
23 24 25 |
# File 'lib/listcordrb/bot.rb', line 23 def error? !@data['message'].nil? end |
#id ⇒ Integer Also known as: clientid
Get the bot’s ID.
47 48 49 |
# File 'lib/listcordrb/bot.rb', line 47 def id @data['id'].to_i end |
#invite ⇒ String
The custom bot invite url of the bot.
29 30 31 |
# File 'lib/listcordrb/bot.rb', line 29 def invite @data['invite'] end |
#invites ⇒ Integer
The amount of times the invite button has been clicked for the bot.
156 157 158 |
# File 'lib/listcordrb/bot.rb', line 156 def invites @data['invites'] end |
#online? ⇒ true, false Also known as: online
Is the bot online or not?.
148 149 150 |
# File 'lib/listcordrb/bot.rb', line 148 def online? @data['online'] end |
#owners ⇒ Array<String>
The owners of the bot. First one in the array is the main owner.
142 143 144 |
# File 'lib/listcordrb/bot.rb', line 142 def owners @data['owners'] end |
#prefix ⇒ Integer
Get the bot’s prefix
110 111 112 |
# File 'lib/listcordrb/bot.rb', line 110 def prefix @data['prefix'] end |
#premium? ⇒ true, false Also known as:
The premium status of the bot.
134 135 136 |
# File 'lib/listcordrb/bot.rb', line 134 def premium? @data['premium'] end |
#servers ⇒ Integer Also known as: guilds, guild, server
Get the bot’s server count
100 101 102 |
# File 'lib/listcordrb/bot.rb', line 100 def servers @data['servers'].to_i end |
#support ⇒ String
The support server invite code of the bot.
88 89 90 |
# File 'lib/listcordrb/bot.rb', line 88 def support @data['support'] end |
#support_link ⇒ String
The bot’s support server link, ready for clicking.
94 95 96 |
# File 'lib/listcordrb/bot.rb', line 94 def support_link "https://discord.gg/#{support}" end |
#username ⇒ String
The username of the bot.
76 77 78 |
# File 'lib/listcordrb/bot.rb', line 76 def username @data['username'] end |
#verified? ⇒ true, false
The verified status of the bot.
122 123 124 |
# File 'lib/listcordrb/bot.rb', line 122 def verified? @data['verified'] end |
#votes ⇒ Integer
The amount of upvotes the bot has.
116 117 118 |
# File 'lib/listcordrb/bot.rb', line 116 def votes @data['votes'].to_i end |
#website ⇒ String
The website url of the bot.
35 36 37 |
# File 'lib/listcordrb/bot.rb', line 35 def website @data['website'] end |