Class: Dbl::Bot
- Inherits:
-
Object
- Object
- Dbl::Bot
- Defined in:
- lib/topgg/bot.rb
Overview
The Bot class spreads the json parsed hash into different methods
Instance Attribute Summary collapse
-
#obj ⇒ Hash
(also: #raw, #data)
readonly
Returns raw hash of the parsed json object.
Instance Method Summary collapse
-
#avatar ⇒ String
Returns the avatar link of the bot.
-
#bannerUrl ⇒ String
Returns the bot banner url.
-
#certifiedBot ⇒ Boolean
Returns true/false depending on if the bot is certified or not.
-
#clientid ⇒ String
Returns the bot client id.
-
#date ⇒ Date
Returns the date on which the bot was submitted.
-
#defAvatar ⇒ String
Returns the default Avatar of the client.
-
#descriminator ⇒ String
Returns the bot descriminator.
-
#donatebotguildid ⇒ String
Returns the donate bot guild ID.
-
#error ⇒ String
Returns error message, if there’s an error.
-
#github ⇒ String
Returns github repository link, if any.
-
#guilds ⇒ String
Returns configured guilds in which the bot is in.
-
#id ⇒ String
Returns the bot id.
-
#initialize(obj) ⇒ Bot
constructor
Initializes the Bot class.
-
#invite ⇒ String
Returns the invite link of the bot.
-
#lib ⇒ String
Returns the bot library.
-
#longdesc ⇒ String
Returns the long Description of the bot.
-
#monthlyPoints ⇒ String
Returns the monthyPoints of the bot.
-
#owners ⇒ Array<String>
Returns the owner ids.
-
#points ⇒ String
Returns the total points of the bot.
-
#prefix ⇒ String
Returns the default prefix of the bot.
-
#server_count ⇒ Integer
Returns the server count of the bot.
-
#shard_count ⇒ String
Returns the amount of shards.
-
#shards ⇒ String
Returns the amount of guilds per shard of the bot.
-
#shortdesc ⇒ String
Returns the short description of the bot.
-
#support ⇒ String
Returns support server link.
-
#tags ⇒ Array<String>
Return the bot tags.
-
#username ⇒ String
Returns the bot username.
-
#website ⇒ String
Returns the bot website, if configured.
Constructor Details
#initialize(obj) ⇒ Bot
Initializes the Bot class
6 7 8 |
# File 'lib/topgg/bot.rb', line 6 def initialize(obj) @obj = obj end |
Instance Attribute Details
#obj ⇒ Hash (readonly) Also known as: raw, data
Returns raw hash of the parsed json object
11 12 13 |
# File 'lib/topgg/bot.rb', line 11 def obj @obj end |
Instance Method Details
#avatar ⇒ String
Returns the avatar link of the bot
84 85 86 |
# File 'lib/topgg/bot.rb', line 84 def avatar "https://cdn.discordapp.com/avatars/#{@obj['id']}/#{@obj['avatar']}.webp?size=1024" end |
#bannerUrl ⇒ String
Returns the bot banner url
168 169 170 |
# File 'lib/topgg/bot.rb', line 168 def @obj['bannerUrl'].to_str end |
#certifiedBot ⇒ Boolean
Returns true/false depending on if the bot is certified or not
150 151 152 |
# File 'lib/topgg/bot.rb', line 150 def certifiedBot @obj['certifiedBot'].to_str end |
#clientid ⇒ String
Returns the bot client id
78 79 80 |
# File 'lib/topgg/bot.rb', line 78 def clientid @obj['clientid'].to_str end |
#date ⇒ Date
Returns the date on which the bot was submitted
108 109 110 |
# File 'lib/topgg/bot.rb', line 108 def date Date.parse(@obj['date']) end |
#defAvatar ⇒ String
Returns the default Avatar of the client
24 25 26 |
# File 'lib/topgg/bot.rb', line 24 def defAvatar @obj['defAvatar'].to_str end |
#descriminator ⇒ String
Returns the bot descriminator
96 97 98 |
# File 'lib/topgg/bot.rb', line 96 def descriminator @obj['descriminator'].to_str end |
#donatebotguildid ⇒ String
Returns the donate bot guild ID
174 175 176 |
# File 'lib/topgg/bot.rb', line 174 def donatebotguildid @obj['donatebotguildid'].to_str end |
#error ⇒ String
Returns error message, if there’s an error
18 19 20 |
# File 'lib/topgg/bot.rb', line 18 def error @obj['error'].to_str end |
#github ⇒ String
Returns github repository link, if any
48 49 50 |
# File 'lib/topgg/bot.rb', line 48 def github @obj['github'].to_str end |
#guilds ⇒ String
Returns configured guilds in which the bot is in
126 127 128 |
# File 'lib/topgg/bot.rb', line 126 def guilds @obj['guilds'].to_str end |
#id ⇒ String
Returns the bot id
90 91 92 |
# File 'lib/topgg/bot.rb', line 90 def id @obj['id'].to_str end |
#invite ⇒ String
Returns the invite link of the bot
30 31 32 |
# File 'lib/topgg/bot.rb', line 30 def invite @obj['invite'].to_str end |
#lib ⇒ String
Returns the bot library
72 73 74 |
# File 'lib/topgg/bot.rb', line 72 def lib @obj['lib'].to_str end |
#longdesc ⇒ String
Returns the long Description of the bot
54 55 56 |
# File 'lib/topgg/bot.rb', line 54 def longdesc @obj['longdesc'].to_str end |
#monthlyPoints ⇒ String
Returns the monthyPoints of the bot
138 139 140 |
# File 'lib/topgg/bot.rb', line 138 def monthlyPoints @obj['monthlyPoints'].to_str end |
#owners ⇒ Array<String>
Returns the owner ids
156 157 158 |
# File 'lib/topgg/bot.rb', line 156 def owners @obj['owners'].to_str end |
#points ⇒ String
Returns the total points of the bot
144 145 146 |
# File 'lib/topgg/bot.rb', line 144 def points @obj['points'].to_str end |
#prefix ⇒ String
Returns the default prefix of the bot
66 67 68 |
# File 'lib/topgg/bot.rb', line 66 def prefix @obj['prefix'].to_str end |
#server_count ⇒ Integer
Returns the server count of the bot
114 115 116 |
# File 'lib/topgg/bot.rb', line 114 def server_count @obj['server_count'].to_i end |
#shard_count ⇒ String
Returns the amount of shards
120 121 122 |
# File 'lib/topgg/bot.rb', line 120 def shard_count @obj['shard_count'].to_str end |
#shards ⇒ String
Returns the amount of guilds per shard of the bot
132 133 134 |
# File 'lib/topgg/bot.rb', line 132 def shards @obj['shards'].to_str end |
#shortdesc ⇒ String
Returns the short description of the bot
60 61 62 |
# File 'lib/topgg/bot.rb', line 60 def shortdesc @obj['shortdesc'].to_str end |
#support ⇒ String
Returns support server link
42 43 44 |
# File 'lib/topgg/bot.rb', line 42 def support "https://discord.gg/#{@obj['support']}" end |
#tags ⇒ Array<String>
Return the bot tags
162 163 164 |
# File 'lib/topgg/bot.rb', line 162 def @obj['tags'].to_str end |
#username ⇒ String
Returns the bot username
102 103 104 |
# File 'lib/topgg/bot.rb', line 102 def username @obj['username'].to_str end |
#website ⇒ String
Returns the bot website, if configured
36 37 38 |
# File 'lib/topgg/bot.rb', line 36 def website @obj['website'].to_str end |