Class: ListCordRB

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

Overview

All ListCordRB functionality, whether extended or just here.

Defined Under Namespace

Classes: Bot, GetBots, Stats

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(apikey, id) ⇒ ListCordRB

Initialize a new ListCord instance, via an api-key.

Parameters:

  • apikey (String)

    API Key of the bot, received from the ListCord API doc site.

  • id (Integer, String)

    Integer/String of your bot’s id.



10
11
12
13
14
# File 'lib/listcordrb.rb', line 10

def initialize(apikey, id)
  @api = apikey
  @id = id
  makestats
end

Instance Attribute Details

#apiString

Returns the api key.

Returns:

  • (String)

    the api key.



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

def api
  @api
end

#botObject (readonly)

Returns the value of attribute bot.



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

def bot
  @bot
end

#idInteger

Returns the ID.

Returns:

  • (Integer)

    the ID.



25
26
27
# File 'lib/listcordrb.rb', line 25

def id
  @id
end

#statsObject (readonly)

Returns the value of attribute stats.



51
52
53
# File 'lib/listcordrb.rb', line 51

def stats
  @stats
end

Instance Method Details

#getbots(query, sort = 'votes', limit = 1, page = 1) ⇒ Object

Find a bot. Initialize the get bots

Parameters:

  • query (String)

    Name of the bot.

  • sort (String) (defaults to: 'votes')

    Type of sort, can be votes, servers, newest, or invites, default votes.

  • limit (Integer) (defaults to: 1)

    amount of bots to return. Max 10, default 1.

  • page (Integer) (defaults to: 1)

    page of bots, takes limit and mulitplies by this.



47
48
49
# File 'lib/listcordrb.rb', line 47

def getbots(query, sort = 'votes', limit = 1, page = 1)
  GetBots.new(query, sort, limit, page)
end

#loadbot(id) ⇒ Object

Load a bot.

Parameters:

  • id (Integer, String)

    Integer/String ID of the bot you’re requesting.



37
38
39
# File 'lib/listcordrb.rb', line 37

def loadbot(id)
  @bot = Bot.new(id)
end

#makestatsObject

Initialize Stats



17
18
19
# File 'lib/listcordrb.rb', line 17

def makestats
  @stats = Stats.new(@api, @id)
end