class ListCordRB::Stats

Stats and stuff, ya know.

Public Class Methods

new(apikey, id) click to toggle source

Initialize the stats Program does this automatically when running ListCordRB.new.

# File lib/listcordrb/stats.rb, line 5
def initialize(apikey, id)
  @api = apikey
  @id = id
end

Public Instance Methods

servercount()
Alias for: servers
servers() click to toggle source

Get the server count, returns an int.

# File lib/listcordrb/stats.rb, line 11
def servers
  url = "https://listcord.com/api/bot/#{@id}"
  JSON.parse(RestClient.get(url))['servers'].to_i
end
Also aliased as: servercount
servers=(count, shard = nil) click to toggle source

Update the bot's server count.

# File lib/listcordrb/stats.rb, line 19
def servers=(count, shard = nil)
  url = "https://listcord.com/api/bot/#{@id}/guilds"
  json = {
    'guilds' => count.to_s,
    'shard' => shard.to_s
  }
  RestClient.post(url, json, :Authorization => @api, :'Content-Type' => :json)
end
Also aliased as: updateservers
updateservers(count, shard = nil)
Alias for: servers=