Class: DBLRuby::Bot

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

Overview

Find information about bots.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Bot

Initialize the bot

Parameters:

  • data (JSON)

    Bot object in JSON form.


5
6
7
# File 'lib/dblruby/bot.rb', line 5

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly) Also known as: to_s

Returns data in raw json form.

Returns:

  • data in raw json form.


10
11
12
# File 'lib/dblruby/bot.rb', line 10

def data
  @data
end

Instance Method Details

#avatarString

The avatar hash of the bot's avatar.

Returns:

  • (String)

    the bot's avatar.


82
83
84
# File 'lib/dblruby/bot.rb', line 82

def avatar
  @data['avatar']
end

#avatar_imgString

Get's the bot's avatar as an img, ready to be used in image linking.

Returns:

  • (String)

    the bot's avatar image url.


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.

Returns:

  • (true, false)

    the bot's certified status.


185
186
187
# File 'lib/dblruby/bot.rb', line 185

def certified?
  @data['certifiedBot']
end

#clientidInteger

Get the bot's Client ID.

Returns:

  • (Integer)

    the bot's client id.


70
71
72
# File 'lib/dblruby/bot.rb', line 70

def clientid
  @data['clientid'].to_i
end

#dateDate

The date when the bot was approved.

Returns:

  • (Date)

    the bot's approval date.


121
122
123
# File 'lib/dblruby/bot.rb', line 121

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

#defavatarString

The cdn hash of the bot's avatar if the bot has none.

Returns:

  • (String)

    the bot's defAvatar.


76
77
78
# File 'lib/dblruby/bot.rb', line 76

def defavatar
  @data['defAvatar']
end

#discriminatorString Also known as: discrim, tag

The discriminator of the bot.

Returns:

  • (String)

    the bot's discriminator.


100
101
102
# File 'lib/dblruby/bot.rb', line 100

def discriminator
  @data['discriminator']
end

#distinctString

Returns the bot's distinct, which is the Username and Discriminator.

Returns:

  • (String)

    the bot's distinct.


115
116
117
# File 'lib/dblruby/bot.rb', line 115

def distinct
  "#{username}\##{tag}"
end

#donatebotguildidString Also known as: donatebotserverid

Get the bot's donate bot guild ID.

Returns:

  • (String)

    the bot's donate bot guild ID.


207
208
209
# File 'lib/dblruby/bot.rb', line 207

def donatebotguildid
  @data['donatebotguildid']
end

#errorString?

Return the error if there is one, nil otherwise.

Returns:

  • (String, nil)

    the error.


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.

Returns:

  • (true, false)

    if there is an error.


22
23
24
# File 'lib/dblruby/bot.rb', line 22

def error?
  !@data['error'].nil?
end

#githubString

The link to the github repo of the bot.

Returns:

  • (String)

    the bot's GitHub Repo link.


34
35
36
# File 'lib/dblruby/bot.rb', line 34

def github
  @data['github']
end

#guildsArray<String> Also known as: servers

Get the bot's “This Bot Powers the following Servers”

Returns:

  • (Array<String>)

    the bot's guilds.


155
156
157
# File 'lib/dblruby/bot.rb', line 155

def guilds
  @data['guilds']
end

#idInteger

The id of the bot.

Returns:

  • (Integer)

    the bot's id.


94
95
96
# File 'lib/dblruby/bot.rb', line 94

def id
  @data['id'].to_i
end

#inviteString

The custom bot invite url of the bot.

Returns:

  • (String)

    the bot's invite link.


28
29
30
# File 'lib/dblruby/bot.rb', line 28

def invite
  @data['invite']
end

#libString

The library of the bot.

Returns:

  • (String)

    the bot's library.


64
65
66
# File 'lib/dblruby/bot.rb', line 64

def lib
  @data['lib']
end

#longdescString

The long description of the bot. Can contain HTML and/or Markdown.

Returns:

  • (String)

    the bot's Long Description.


46
47
48
# File 'lib/dblruby/bot.rb', line 46

def longdesc
  @data['longdesc']
end

#monthlypointsInteger Also known as: monthlyvotes

The amount of upvotes the bot has this month.

Returns:

  • (Integer)

    the bot's monthly points/votes.


169
170
171
# File 'lib/dblruby/bot.rb', line 169

def monthlypoints
  @data['monthlyPoints'].to_i
end

#ownersArray<String>

The owners of the bot. First one in the array is the main owner.

Returns:

  • (Array<String>)

    the bot's owners in an array.


195
196
197
# File 'lib/dblruby/bot.rb', line 195

def owners
  @data['owners']
end

#pointsInteger Also known as: votes

The amount of upvotes the bot has.

Returns:

  • (Integer)

    the bot's total points/votes.


177
178
179
# File 'lib/dblruby/bot.rb', line 177

def points
  @data['points'].to_i
end

#prefixString

The prefix of the bot.

Returns:

  • (String)

    the bot's prefix.


58
59
60
# File 'lib/dblruby/bot.rb', line 58

def prefix
  @data['prefix']
end

#server_countInteger Also known as: guild_count, server

Get the bot's server count

Returns:

  • (Integer)

    the bot's server count.


146
147
148
# File 'lib/dblruby/bot.rb', line 146

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

#shardsArray<String>

Get the bot's shards.

Returns:

  • (Array<String>)

    the bot's shards.


163
164
165
# File 'lib/dblruby/bot.rb', line 163

def shards
  @data['shards']
end

#shortdescString

The short description of the bot.

Returns:

  • (String)

    the bot's Short Description.


52
53
54
# File 'lib/dblruby/bot.rb', line 52

def shortdesc
  @data['shortdesc']
end

#supportString

The support server invite code of the bot.

Returns:

  • (String)

    the bot's support server code.


134
135
136
# File 'lib/dblruby/bot.rb', line 134

def support
  @data['support']
end

The bot's support server link, ready for clicking.

Returns:

  • (String)

    the bot's support server link.


140
141
142
# File 'lib/dblruby/bot.rb', line 140

def support_link
  "https://discord.gg/#{support}"
end

#tagsArray<String>

The tags of the bot.

Returns:

  • (Array<String>)

    the bot's tags in an array.


201
202
203
# File 'lib/dblruby/bot.rb', line 201

def tags
  @data['tags']
end

#timeTime

The time when the bot was approved. This is compatiable with embed.timestamp, unlike #date

Returns:

  • (Time)

    the bot's approval time.


128
129
130
# File 'lib/dblruby/bot.rb', line 128

def time
  Time.parse(@data['date'])
end

#usernameString

The username of the bot.

Returns:

  • (String)

    the bot's username.


109
110
111
# File 'lib/dblruby/bot.rb', line 109

def username
  @data['username']
end

#websiteString

The website url of the bot.

Returns:

  • (String)

    the bot's website link.


40
41
42
# File 'lib/dblruby/bot.rb', line 40

def website
  @data['website']
end