Class: DBio

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

Overview

All DBio functionality, whether extended or just here.

Defined Under Namespace

Classes: DiscordConnection, DiscordProfile, SearchResult, User, UserConnection

Instance Method Summary collapse

Constructor Details

#initializeDBio

Initialize the API. Not much here really.


8
# File 'lib/dbio.rb', line 8

def initialize; end

Instance Method Details

#search(user) ⇒ Array<SearchResult>

Searches for a user This API is not publicly documented and can break at any time. Be careful!

Returns:


31
32
33
# File 'lib/dbio.rb', line 31

def search(user)
  JSON.parse(RestClient.get("https://api.discord.bio/user/search/#{user}"))['payload'].map { |e| SearchResult.new(e) }
end

#top_likesArray<SearchResult>

Returns the users by most likes. Their data is short, so it's not really worth storing a lot of data

Returns:

See Also:

  • DBio.[SearchResult[SearchResult#user]

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

def top_likes
  JSON.parse(RestClient.get("https://api.discord.bio/topLikes"))['payload'].map { |e| SearchResult.new(e) }
end

#user(id) ⇒ User

Load a user

Parameters:

  • id (Integer, String)

    the user ID or name of the requested user.

Returns:

  • (User)

    the new user object

Raises:

  • (RestClient::NotFound)

    if the specified user does not exist


14
15
16
17
18
# File 'lib/dbio.rb', line 14

def user(id)
  user = JSON.parse(RestClient.get("https://api.discord.bio/user/details/#{id}"))

  User.new(user['payload'])
end