class ListCordRB::GetBots
Stats and stuff, ya know.
Attributes
data[R]
@return data in raw json form.
limit[R]
@return the original limit.
page[R]
@return the original page.
query[R]
@return the original query.
sort[R]
@return the original sort method.
to_s[R]
@return data in raw json form.
Public Class Methods
new(query, sort = 'votes', limit = 1, page = 1)
click to toggle source
Initialize the get bots @param query [String] Name of the bot. @param sort [String] Type of sort, can be votes, servers, newest, or invites, default votes. @param limit [Integer] amount of bots to return. Max 10, default 1. @param page [Integer] page of bots, takes limit and mulitplies by this.
# File lib/listcordrb/getbots.rb, line 8 def initialize(query, sort = 'votes', limit = 1, page = 1) @query = query @sort = sort @limit = limit @page = page url = "https://listcord.com/api/bots/#{sort}/#{limit}/#{page * limit - 1}" @data = JSON.parse(RestClient.get(url, params: { q: query })) end
Public Instance Methods
first()
click to toggle source
@return [Integer] the ID of the first bot
# File lib/listcordrb/getbots.rb, line 40 def first @data[0].to_i end
next()
click to toggle source
Go to the next page of bots
# File lib/listcordrb/getbots.rb, line 35 def next ListCordRB::GetBots.new(@query, @sort, @limit, @page + 1) end