1.0.33 • Published 2 years ago

venge.js v1.0.33

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Information:

This package is an addon to venge.io to help newer developers and older developers access data easily from venge.

Installation

Open your terminal and type:

npm init

Following that, prompts should pop up. Spam the enter key until it's finished. Next you will need to install the venge.js package. You can do this by typing

npm i venge.js

Setup

Create an index.js file. Now comes the coding!

const Client = require('venge.js');
const client = new Client(/*Your token*/);

client.on('ready', () => {
  console.log('I am ready to be used!');
});

If this logs I am ready to be used! then you are all setup! Now you can start requesting information from venge!

You can request users stats by using the getStats() function.

const Client = require('venge.js');
const client = new Client(/*Your token*/);

client.on('ready', async () => {
  var stats = await client.getStats('meta');
  console.log(stats);
});

Running this should display the information you are looking for. It should look something similar to this:

{
  id: '3',
  username: 'Meta',
  experience: '71473',
  clan: '6346',
  last_login: '2021-06-27 20:32:32',
  created_at: '2021-05-14 16:08:43',
  last_game_start: '2020-06-08 22:28:29',
  rank: '0',
  current_rank: '0',
  previous_rank: '0',
  verified: '1',
  level: 27,
  coins: '5173865',
  last_coin_claim: '2020-09-14 22:02:51',
  kills: '0',
  kdr: '0',
  deaths: '0',
  assists: '69420',
  headshots: '0',
  total_games_won: '69436',
  total_games_played: '69441',
  total_game_time: '74758',
  last_match_kills: '1',
  last_match_headshots: '1',
  last_match_time: '214',
  last_match_position: '0',
  today_kills: '0',
  today_deaths: '0',
  today_experience: '0',
  week_kills: '1',
  week_deaths: '0',
  week_experience: '0',
  badges: '[]',
  active_emote: '',
  active_hat: '',
  active_skin: '',
  active_booster: '',
  booster_activation_time: '1021-04-08 22:29:50',
  booster_finish_time: '2020-06-08 22:28:13',
  daily_quest_last_date: '2020-06-08 22:28:16',
  daily_quest_count: '0',
  profile_picture_hash: '',
  twitter: '0',
  twitch: '0',
  banned_until: '2020-01-01 00:00:00',
  is_banned: '0',
  is_creator: '1',
  profile_views: '999',
  emoji: 'None',
  last_coin_bought: '2020-05-05 00:00:00',
  last_special_offer: '2021-04-15 10:47:52',
  next_chest_claim: '2021-04-13 16:58:44',
  kill_message: ''
}

If you've used our APIs before you might be thinking this is a lot more information than what the URL APIs gave. You would be correct! With this API we are going to add as much information in here as we can as long as what we are giving out isn't too much information and could possibly breach our users security.

Example: Here is an example of how it could be used!

const Client = require('venge.js');
const client = new Client(/*Your token*/);

client.on('ready', async () => {
  var account = await client.getStats('meta');
  console.log('The user ' + account.username + ' is the ' + account.id + 'rd account ever created!');
});

It outputs this in console:

The user Meta is the 3rd account ever created!

You can request leaderboard information by using the getLeaderboard() function.

const Client = require('venge.js');
const client = new Client(/*Your token*/);

client.on('ready', async () => {
  var stats = await client.getLeaderboard('score');
  console.log(stats);
});

Running this should display the information you are looking for. It should look something similar to this:

[
  {
    username: '\\[[color="#237FFF"]S[/color][color="#FFA323"]W[/color][color="#FF2323"]A[/color][color="#237FFF"]T[/color]] Nand8',
    raw_username: 'Nand8',
    emoji: 'Mask',
    experience: '5244061',
    verified: '0',
    active_skin: '',
    rank: '0',
    current_rank: '15',
    previous_rank: null,
    kills: '269594',
    deaths: '65012',
    kdr: '4.15'
  },
  {
    username: '\\[[color="#237FFF"]S[/color][color="#FFA323"]W[/color][color="#FF2323"]A[/color][color="#237FFF"]T[/color]] Pua',
    raw_username: 'Pua',
    emoji: 'None',
    experience: '3043064',
    verified: '0',
    active_skin: '',
    rank: '0',
    current_rank: '3',
    previous_rank: null,
    kills: '115741',
    deaths: '38984',
    kdr: '2.97'
  },
  {
    username: '\\[[color="#237FFF"]S[/color][color="#FFA323"]W[/color][color="#FF2323"]A[/color][color="#237FFF"]T[/color]] Qi',
    raw_username: 'Qi',
    emoji: 'None',
    experience: '2691678',
    verified: '0',
    active_skin: '',
    rank: '0',
    current_rank: '84',
    previous_rank: null,
    kills: '104248',
    deaths: '40798',
    kdr: '2.56'
  },
  {
    username: '\\[[color="#FFA323"]1[/color]] StreamKing',
    raw_username: 'StreamKing',
    emoji: 'SunGlass',
    experience: '1706745',
    verified: '1',
    active_skin: '',
    rank: '0',
    current_rank: '69',
    previous_rank: null,
    kills: '114539',
    deaths: '10613',
    kdr: '10.79'
  },
  {
    username: '\\[[color="#FF2323"]N00N[/color]] polip8',
    raw_username: 'polip8',
    emoji: 'None',
    experience: '1186475',
    verified: '0',
    active_skin: '',
    rank: '0',
    current_rank: '42',
    previous_rank: null,
    kills: '138246',
    deaths: '51393',
    kdr: '2.69'
  },
  {
    username: 'Aggareth',
    raw_username: 'Aggareth',
    emoji: 'SunGlass',
    experience: '1164561',
    verified: '0',
    active_skin: '',
    rank: '0',
    current_rank: '100',
    previous_rank: null,
    kills: '82968',
    deaths: '7681',
    kdr: '10.80'
  },
  {
    username: '\\[[color="#237FFF"]I[/color][color="#FFA323"]C[/color][color="#FF2323"]O[/color][color="#237FFF"]N[/color]] lilnigle',
    raw_username: 'lilnigle',
    emoji: 'None',
    experience: '1147715',
    verified: '0',
    active_skin: '',
    rank: '0',
    current_rank: '35',
    previous_rank: null,
    kills: '110320',
    deaths: '12992',
    kdr: '8.49'
  }, etc...

It returns an array with objects in them, they're all listed in order descending from 1 to 50 (Some leaderboards go up to 100 so keep that in mind)

With this function you can grab all leaderboards. The current ones we have are Daily, Weekly, Score, Followers, Headshots, Kills, and Clans. Here is an example:

var dailyLeaderboard = await client.getLeaderboard('daily');
var weeklyLeaderboard = await client.getLeaderboard('weekly');
var scoreLeaderboard = await client.getLeaderboard('score');
var followersLeaderboard = await client.getLeaderboard('followers');
var headshotsLeaderboard = await client.getLeaderboard('headshots');
var killsLeaderboard = await client.getLeaderboard('kills');
var clansLeaderboard = await client.getLeaderboard('clans');

Example: Here is an example of how it could be used.

const Client = require('./index.js');
const client = new Client('betatest');

client.on('ready', async () => {
    var leaderboard = await client.getLeaderboard('score');

    for(i = 0; i < leaderboard.length; i++) {
        console.log((i + 1) + '. ' + leaderboard[i].raw_username + '\nExperience: ' + leaderboard[i].experience);
    }
});

It outputs this in console:

1. Nand8
Experience: 5244061
2. Pua
Experience: 3043317
3. Qi
Experience: 2691678
4. StreamKing
Experience: 1706745
5. polip8
Experience: 1186475
6. Aggareth
Experience: 1164561
7. lilnigle
Experience: 1147715
8. losco
Experience: 1087291
9. Anselmo
Experience: 1033144
10. ZZZULEMAS
Experience: 1025516
11. 1jaymen
Experience: 988096
12. klax
Experience: 978523
13. 247166
Experience: 973675
14. EAGLE1
Experience: 934360
15. averagejoe24/7
Experience: 898050
16. dan678
Experience: 886235
17. JohnVein
Experience: 866125
18. vrandito
Experience: 853500
19. Rooberttoo
Experience: 835832
20. pinkyhair
Experience: 822318
21. Fran2302
Experience: 810317
22. Tomogunchi
Experience: 793425
23. Gimmick88
Experience: 785029
24. chanaro
Experience: 766317
25. Juanes123
Experience: 702664
26. yourdeadbutimnot
Experience: 686991
27. indirkazan.net
Experience: 681076
28. paro
Experience: 646020
29. xoxmedturkiye
Experience: 640046
30. Numair
Experience: 629919
31. MrCubiqs
Experience: 626281
32. KAAN
Experience: 619105
33. mark@usa
Experience: 617189
34. nleman34
Experience: 602912
35. YouVeryVeryEasy
Experience: 595652
36. StyleCop
Experience: 589100
37. DIDIROCH
Experience: 583864
38. Geno
Experience: 570585
39. _Xvirus_
Experience: 569183
40. ROMAN_REIGNS
Experience: 564329
41. sayanFF
Experience: 540089
42. 333666999
Experience: 539533
43. fugaz13
Experience: 532882
44. Diarrhea
Experience: 528274
45. rodman00
Experience: 525299
46. Guest106
Experience: 523486
47. Whitchy
Experience: 517075
48. Locutor
Experience: 516241
49. SenseiDrip
Experience: 512029
50. Xfarganx
Experience: 506735

You can request clans information by using the getClan() function.

var Client = require('venge.js');
var client = new Client(/*Your token*/);

client.on('ready', async () => {
  var clan = await client.getClan('Dua Lipa');

  console.log(clan);
});

Running this should display the information you are looking for. It should look something similar to this:

{
  id: '6346',
  name: 'Dua Lipa',
  slug: 'Dua Lipa',
  user_id: '3',
  social_link: '',
  welcome_message: 'Dua Lipa = Best Singer',
  experience: '9445',
  kills: '915',
  deaths: '403',
  rank: '0',
  previous_rank: '0',
  private: '0',
  bank: '1000069',
  level: '4',
  created_at: '2021-03-17 18:46:10',
  getMembers: [Function (anonymous)],
  getJoinRequests: [Function (anonymous)]
}

It returns an object with the clans information but the last two variables are functions, here is how you can use them to grab more information about the clan:

var Client = require('venge.js');
var client = new Client(/*Your token*/);

client.on('ready', async () => {
  var clan = await client.getClan('Dua Lipa');
  var clanMembers = await clan.getMembers();
  var clanRequests = await clan.getJoinRequests();

  console.log(clanMembers, clanRequests);
});

This will output both clan members and clan join requests together in console. It should look like this:

{
  members: [
    { username: 'Meta', role: 'Lipa' },
    { username: 'Shady', role: 'Lipa' },
    { username: 'sinajune', role: 'Dua' }
  ],
  size: 3
} {
  requests: [
    { username: 'FaZe_Xeon' },
    { username: 'DEMON7SIX' },
    { username: 'Jamthegoat' },
    { username: 'nathanroman12' },
    { username: 'Sofia2020_oloooo' },
    { username: 'vXnishYT' },
    { username: 'muci' },
    { username: 'lautyyy' },
    { username: 'PhobeaYT' },
    { username: '01760110905' },
    { username: 'Death_Criminal' },
    { username: 'darylleorlanes' },
    { username: '#Qwer' }
  ],
  size: 13
}
1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.23

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.1

3 years ago