Class: DBLRuby::Bot
- Inherits:
-
Object
- Object
- DBLRuby::Bot
- Defined in:
- lib/dblruby/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
(also: #certifiedbot, #certified, #certifiedbot?)
The certified status of the bot.
-
#clientid ⇒ Integer
Get the bot’s Client ID.
-
#date ⇒ Date
The date when the bot was approved.
-
#defavatar ⇒ String
The cdn hash of the bot’s avatar if the bot has none.
-
#discriminator ⇒ String
(also: #discrim, #tag)
The discriminator of the bot.
-
#distinct ⇒ String
Returns the bot’s distinct, which is the Username and Discriminator.
-
#donatebotguildid ⇒ String
(also: #donatebotserverid)
Get the bot’s donate bot guild ID.
-
#error ⇒ String?
Return the error if there is one, nil otherwise.
-
#error? ⇒ true, false
Return true if there is an error, false otherwise.
-
#github ⇒ String
The link to the github repo of the bot.
-
#guilds ⇒ Array<String>
(also: #servers)
Get the bot’s “This Bot Powers the following Servers”.
-
#id ⇒ Integer
The id of the bot.
-
#initialize(data) ⇒ Bot
constructor
Initialize the bot.
-
#invite ⇒ String
The custom bot invite url of the bot.
-
#lib ⇒ String
The library of the bot.
-
#longdesc ⇒ String
The long description of the bot.
-
#monthlypoints ⇒ Integer
(also: #monthlyvotes)
The amount of upvotes the bot has this month.
-
#owners ⇒ Array<String>
The owners of the bot.
-
#points ⇒ Integer
(also: #votes)
The amount of upvotes the bot has.
-
#prefix ⇒ String
The prefix of the bot.
-
#server_count ⇒ Integer
(also: #guild_count, #server)
Get the bot’s server count.
-
#shards ⇒ Array<String>
Get the bot’s shards.
-
#shortdesc ⇒ String
The short description of the bot.
-
#support ⇒ String
The support server invite code of the bot.
-
#support_link ⇒ String
The bot’s support server link, ready for clicking.
-
#tags ⇒ Array<String>
The tags of the bot.
-
#time ⇒ Time
The time when the bot was approved.
-
#username ⇒ String
The username of the bot.
-
#website ⇒ String
The website url of the bot.
Constructor Details
#initialize(data) ⇒ Bot
Initialize the bot
5 6 7 |
# File 'lib/dblruby/bot.rb', line 5 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly) Also known as: to_s
Returns data in raw json form.
10 11 12 |
# File 'lib/dblruby/bot.rb', line 10 def data @data end |
Instance Method Details
#avatar ⇒ String
The avatar hash of the bot’s avatar.
82 83 84 |
# File 'lib/dblruby/bot.rb', line 82 def avatar @data['avatar'] end |
#avatar_img ⇒ String
Get’s the bot’s avatar as an img, ready to be used in image linking.
88 89 90 |
# File 'lib/dblruby/bot.rb', line 88 def avatar_img "https://cdn.discordapp.com/avatars/#{id}/#{avatar}.webp?size=1024" end |
#certified? ⇒ true, false Also known as: certifiedbot, certified, certifiedbot?
The certified status of the bot.
185 186 187 |
# File 'lib/dblruby/bot.rb', line 185 def certified? @data['certifiedBot'] end |
#clientid ⇒ Integer
Get the bot’s Client ID.
70 71 72 |
# File 'lib/dblruby/bot.rb', line 70 def clientid @data['clientid'].to_i end |
#date ⇒ Date
The date when the bot was approved.
121 122 123 |
# File 'lib/dblruby/bot.rb', line 121 def date Date.parse(@data['date']) end |
#defavatar ⇒ String
The cdn hash of the bot’s avatar if the bot has none.
76 77 78 |
# File 'lib/dblruby/bot.rb', line 76 def defavatar @data['defAvatar'] end |
#discriminator ⇒ String Also known as: discrim, tag
The discriminator of the bot.
100 101 102 |
# File 'lib/dblruby/bot.rb', line 100 def discriminator @data['discriminator'] end |
#distinct ⇒ String
Returns the bot’s distinct, which is the Username and Discriminator.
115 116 117 |
# File 'lib/dblruby/bot.rb', line 115 def distinct "#{username}\##{tag}" end |
#donatebotguildid ⇒ String Also known as: donatebotserverid
Get the bot’s donate bot guild ID.
207 208 209 |
# File 'lib/dblruby/bot.rb', line 207 def donatebotguildid @data['donatebotguildid'] end |
#error ⇒ String?
Return the error if there is one, nil otherwise.
16 17 18 |
# File 'lib/dblruby/bot.rb', line 16 def error @data['error'] end |
#error? ⇒ true, false
Return true if there is an error, false otherwise.
22 23 24 |
# File 'lib/dblruby/bot.rb', line 22 def error? !@data['error'].nil? end |
#github ⇒ String
The link to the github repo of the bot.
34 35 36 |
# File 'lib/dblruby/bot.rb', line 34 def github @data['github'] end |
#guilds ⇒ Array<String> Also known as: servers
Get the bot’s “This Bot Powers the following Servers”
155 156 157 |
# File 'lib/dblruby/bot.rb', line 155 def guilds @data['guilds'] end |
#id ⇒ Integer
The id of the bot.
94 95 96 |
# File 'lib/dblruby/bot.rb', line 94 def id @data['id'].to_i end |
#invite ⇒ String
The custom bot invite url of the bot.
28 29 30 |
# File 'lib/dblruby/bot.rb', line 28 def invite @data['invite'] end |
#lib ⇒ String
The library of the bot.
64 65 66 |
# File 'lib/dblruby/bot.rb', line 64 def lib @data['lib'] end |
#longdesc ⇒ String
The long description of the bot. Can contain HTML and/or Markdown.
46 47 48 |
# File 'lib/dblruby/bot.rb', line 46 def longdesc @data['longdesc'] end |
#monthlypoints ⇒ Integer Also known as: monthlyvotes
The amount of upvotes the bot has this month.
169 170 171 |
# File 'lib/dblruby/bot.rb', line 169 def monthlypoints @data['monthlyPoints'].to_i end |
#owners ⇒ Array<String>
The owners of the bot. First one in the array is the main owner.
195 196 197 |
# File 'lib/dblruby/bot.rb', line 195 def owners @data['owners'] end |
#points ⇒ Integer Also known as: votes
The amount of upvotes the bot has.
177 178 179 |
# File 'lib/dblruby/bot.rb', line 177 def points @data['points'].to_i end |
#prefix ⇒ String
The prefix of the bot.
58 59 60 |
# File 'lib/dblruby/bot.rb', line 58 def prefix @data['prefix'] end |
#server_count ⇒ Integer Also known as: guild_count, server
Get the bot’s server count
146 147 148 |
# File 'lib/dblruby/bot.rb', line 146 def server_count @data['server_count'].to_i end |
#shards ⇒ Array<String>
Get the bot’s shards.
163 164 165 |
# File 'lib/dblruby/bot.rb', line 163 def shards @data['shards'] end |
#shortdesc ⇒ String
The short description of the bot.
52 53 54 |
# File 'lib/dblruby/bot.rb', line 52 def shortdesc @data['shortdesc'] end |
#support ⇒ String
The support server invite code of the bot.
134 135 136 |
# File 'lib/dblruby/bot.rb', line 134 def support @data['support'] end |
#support_link ⇒ String
The bot’s support server link, ready for clicking.
140 141 142 |
# File 'lib/dblruby/bot.rb', line 140 def support_link "https://discord.gg/#{support}" end |
#tags ⇒ Array<String>
The tags of the bot.
201 202 203 |
# File 'lib/dblruby/bot.rb', line 201 def @data['tags'] end |
#time ⇒ Time
The time when the bot was approved. This is compatiable with embed.timestamp, unlike #date
128 129 130 |
# File 'lib/dblruby/bot.rb', line 128 def time Time.parse(@data['date']) end |
#username ⇒ String
The username of the bot.
109 110 111 |
# File 'lib/dblruby/bot.rb', line 109 def username @data['username'] end |
#website ⇒ String
The website url of the bot.
40 41 42 |
# File 'lib/dblruby/bot.rb', line 40 def website @data['website'] end |