Class: Dbl::Bot

Inherits:
Object
  • Object
show all
Defined in:
lib/topgg/bot.rb

Overview

The Bot class spreads the json parsed hash into different methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Bot

Initializes the Bot class

Parameters:

  • obj (Object)

6
7
8
# File 'lib/topgg/bot.rb', line 6

def initialize(obj)
  @obj = obj
end

Instance Attribute Details

#objHash (readonly) Also known as: raw, data

Returns raw hash of the parsed json object

Returns:

  • (Hash)

11
12
13
# File 'lib/topgg/bot.rb', line 11

def obj
  @obj
end

Instance Method Details

#avatarString

Returns the avatar link of the bot

Returns:

  • (String)

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

#bannerUrlString

Returns the bot banner url

Returns:

  • (String)

168
169
170
# File 'lib/topgg/bot.rb', line 168

def bannerUrl
  @obj['bannerUrl'].to_str
end

#certifiedBotBoolean

Returns true/false depending on if the bot is certified or not

Returns:

  • (Boolean)

150
151
152
# File 'lib/topgg/bot.rb', line 150

def certifiedBot
  @obj['certifiedBot'].to_str
end

#clientidString

Returns the bot client id

Returns:

  • (String)

78
79
80
# File 'lib/topgg/bot.rb', line 78

def clientid
  @obj['clientid'].to_str
end

#dateDate

Returns the date on which the bot was submitted

Returns:

  • (Date)

108
109
110
# File 'lib/topgg/bot.rb', line 108

def date
  Date.parse(@obj['date'])
end

#defAvatarString

Returns the default Avatar of the client

Returns:

  • (String)

24
25
26
# File 'lib/topgg/bot.rb', line 24

def defAvatar
  @obj['defAvatar'].to_str
end

#descriminatorString

Returns the bot descriminator

Returns:

  • (String)

96
97
98
# File 'lib/topgg/bot.rb', line 96

def descriminator
  @obj['descriminator'].to_str
end

#donatebotguildidString

Returns the donate bot guild ID

Returns:

  • (String)

174
175
176
# File 'lib/topgg/bot.rb', line 174

def donatebotguildid
  @obj['donatebotguildid'].to_str
end

#errorString

Returns error message, if there's an error

Returns:

  • (String)

18
19
20
# File 'lib/topgg/bot.rb', line 18

def error
  @obj['error'].to_str
end

#githubString

Returns github repository link, if any

Returns:

  • (String)

48
49
50
# File 'lib/topgg/bot.rb', line 48

def github
  @obj['github'].to_str
end

#guildsString

Returns configured guilds in which the bot is in

Returns:

  • (String)

126
127
128
# File 'lib/topgg/bot.rb', line 126

def guilds
  @obj['guilds'].to_str
end

#idString

Returns the bot id

Returns:

  • (String)

90
91
92
# File 'lib/topgg/bot.rb', line 90

def id
  @obj['id'].to_str
end

#inviteString

Returns the invite link of the bot

Returns:

  • (String)

30
31
32
# File 'lib/topgg/bot.rb', line 30

def invite
  @obj['invite'].to_str
end

#libString

Returns the bot library

Returns:

  • (String)

72
73
74
# File 'lib/topgg/bot.rb', line 72

def lib
  @obj['lib'].to_str
end

#longdescString

Returns the long Description of the bot

Returns:

  • (String)

54
55
56
# File 'lib/topgg/bot.rb', line 54

def longdesc
  @obj['longdesc'].to_str
end

#monthlyPointsString

Returns the monthyPoints of the bot

Returns:

  • (String)

138
139
140
# File 'lib/topgg/bot.rb', line 138

def monthlyPoints
  @obj['monthlyPoints'].to_str
end

#ownersArray<String>

Returns the owner ids

Returns:

  • (Array<String>)

156
157
158
# File 'lib/topgg/bot.rb', line 156

def owners
  @obj['owners'].to_str
end

#pointsString

Returns the total points of the bot

Returns:

  • (String)

144
145
146
# File 'lib/topgg/bot.rb', line 144

def points
  @obj['points'].to_str
end

#prefixString

Returns the default prefix of the bot

Returns:

  • (String)

66
67
68
# File 'lib/topgg/bot.rb', line 66

def prefix
  @obj['prefix'].to_str
end

#server_countInteger

Returns the server count of the bot

Returns:

  • (Integer)

114
115
116
# File 'lib/topgg/bot.rb', line 114

def server_count
  @obj['server_count'].to_i
end

#shard_countString

Returns the amount of shards

Returns:

  • (String)

120
121
122
# File 'lib/topgg/bot.rb', line 120

def shard_count
  @obj['shard_count'].to_str
end

#shardsString

Returns the amount of guilds per shard of the bot

Returns:

  • (String)

132
133
134
# File 'lib/topgg/bot.rb', line 132

def shards
  @obj['shards'].to_str
end

#shortdescString

Returns the short description of the bot

Returns:

  • (String)

60
61
62
# File 'lib/topgg/bot.rb', line 60

def shortdesc
  @obj['shortdesc'].to_str
end

#supportString

Returns support server link

Returns:

  • (String)

42
43
44
# File 'lib/topgg/bot.rb', line 42

def support
  "https://discord.gg/#{@obj['support']}"
end

#tagsArray<String>

Return the bot tags

Returns:

  • (Array<String>)

162
163
164
# File 'lib/topgg/bot.rb', line 162

def tags
  @obj['tags'].to_str
end

#usernameString

Returns the bot username

Returns:

  • (String)

102
103
104
# File 'lib/topgg/bot.rb', line 102

def username
  @obj['username'].to_str
end

#websiteString

Returns the bot website, if configured

Returns:

  • (String)

36
37
38
# File 'lib/topgg/bot.rb', line 36

def website
  @obj['website'].to_str
end