Skip to content

Commit

Permalink
Merge pull request #199 from Wikinger1988/patch-1
Browse files Browse the repository at this point in the history
Added valorant-stats plugin
  • Loading branch information
Bioblaze authored Oct 23, 2020
2 parents ce59b31 + 97b6e8c commit fdcb90c
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 1 deletion.
8 changes: 8 additions & 0 deletions localization/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@
"error":"Warzone Stats Fehler: {error}",
"info":"@{user} Hier sind meine Warzone-Statistiken: Abschüsse: {kills} / Tode: {deaths} / K/D Ratio: {kdr} / Siege: {wins} / Top 5 Platzierungen: {top5} / Top 10 Platzierungen: {top10} / Ich spielte {totma} Runde / Im Durchschnitt lebe ich für: {avgLife} / Ich bin derzeit Level: {level}"
},
"valorant": {
"activated": "Valorant Stats wurde aktiviert",
"deactivated": "Valorant Stats wurde deaktiviert",
"error": "Valorant Stats Fehler: {error}",
"err": "Wir konnten den Spieler nicht finden!",
"example": "Beispiel: = !valorant-stats Nickname#TAG",
"info": "@{user} Hier sind meine Valorant-Statistiken: Aktueller Rang: {rank} / K/D Ratio: {kdr}% / Sieg Ratio: {kdrg} / Siege: {wins} / Abschüsse: {kills} / Tode: {deaths} / Meisten Abschüsse in einem Match: {mKills} / Gespielte Matches: {totma}"
},
"timed-messages":{
"activated":"Timed-messages wurde aktiviert",
"deactivated":"Timed-messages wurde deaktiviert",
Expand Down
8 changes: 8 additions & 0 deletions localization/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@
"deactivated": "Warzone Stats has been Deactivated",
"error": "Warzone Stats Error: {error}",
"info": "@{user} Here are my Warzone Stats: Kills: {kills} / Deaths: {deaths} / K/D Ratio: {kdr} / Wins: {wins} / Top 5 Placements: {top5} / Top 10 Placements: {top10} / I played {totma} rounds / On average I live for: {avgLife} / I am currently level {level}"
},
"valorant": {
"activated": "Valorant Stats has been Activated",
"deactivated": "Valorant Stats has been Deactivated",
"error": "Valorant Stats Error: {error}",
"err": "We could not find the player!",
"example": "Example Usage: = !valorant-stats Nickname#TAG",
"info": "@{user} here are your Valorant stats: Current Rank: {rank} / K/D Ratio: {kdr}% / Win Ratio: {kdrg} / Total Wins: {wins} / Total Kills: {kills} / Total Deaths: {deaths} / Most Kills in a Match: {mKills} / Total Matches: {totma}"
},
"timed-messages": {
"activated": "Timed-messages has been Activated",
Expand Down
2 changes: 1 addition & 1 deletion localization/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"activated": "Warzone Stats Activado",
"deactivated": "Warzone Stats Desactivado",
"error": "Warzone Stats Error: {error}",
"info": "@{user} Aqui estan mis stats en Warzone:\r Bajas: {kills}\r Muertes: {deaths}\rK/D Ratio: {kdr}\rWins: {wins}\r Top 5: {top5}\r Top 10 : {top10}\r Jugue {totma} rondas\r De media vivo: {avgLife}\r Soy nivel {level}"
"info": "@{user} Aqui estan mis stats en Warzone: Bajas: {kills} / Muertes: {deaths} / K/D Ratio: {kdr} / Wins: {wins} / Top 5: {top5} / Top 10 : {top10} / Jugue {totma} rondas / De media vivo: {avgLife} / Soy nivel {level}"
},
"timed-messages": {
"activated": "Timed-messages Activado",
Expand Down
12 changes: 12 additions & 0 deletions plugins/valorant-stats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

## About
Created by Ulash, Updated by Rehkloos, convert to 2.0 by Wikinger1988

Description: Replies with Valorant stat information From tracker.gg website.

## Trigger:
!valorant-stats <RIOT#NAME>

`example: !valorant-stats 1Matrix1#1111`

## Requirements:
59 changes: 59 additions & 0 deletions plugins/valorant-stats/valorant-stats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const Bot = require('../../modules/Bot.js');
const Tool = require('../../modules/Tool.js');

module.exports = {
name: 'Valorant-Stats',
description: 'Replies with valorant stat information. You need to install overwolf then install Valorant Stats by TRN',
author: "Edited by Ulash, Updated by Rehkloos, Convert to 2.0 by Wikinger1988",
license: "Apache-2.0",
command: 'valorant-stats', // This is the Command that is typed into Chat!
permissions: [], // This is for Permissisons depending on the Platform.
cooldown: 10, // this is Set in Seconds, how long between the next usage of this command.
execute(client, data, ) {

if (!data.args[0]) {
client.sendMessage(Bot.translate("plugins.valorant.example"));
} else if (data.args[0]) {

const urlEncodedName = encodeURIComponent(data.args);
let url = `https://api.tracker.gg/api/v2/valorant/standard/profile/riot/${urlEncodedName}`;

Tool.httpsGet(url).then((output) => {
const brStats = output.data.segments[0];
const kills = brStats.stats.kills.displayValue;
const deaths = brStats.stats.deaths.displayValue;
const mKills = brStats.stats.mostKillsInMatch.displayValue;
const kdr = brStats.stats.kDRatio.displayValue;
const kdrg = brStats.stats.matchesWinPct.displayValue;
const wins = brStats.stats.matchesWon.displayValue;
const totma = brStats.stats.matchesPlayed.displayValue;
const rank = brStats.stats.rank.displayValue;
client.sendMessage(Bot.translate("plugins.valorant.info", {
user: data.user,
rank: rank,
kills: kills,
mKills: mKills,
deaths: deaths,
kdr: kdr,
kdrg: kdrg,
totma: totma,
wins: wins
}));

}).catch((err) => {
Bot.log(Bot.translate("plugins.valorant.error"), {
error: err
});
client.sendMessage(Bot.translate("plugins.valorant.err"), {

});
});
}
},
activate() {
Bot.log(Bot.translate("plugins.valorant.activated"));
},
deactivate() {
Bot.log(Bot.translate("plugins.valorant.deactivated"));
}
};
3 changes: 3 additions & 0 deletions plugins/valorant-stats/valorant-stats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"active": false
}

0 comments on commit fdcb90c

Please sign in to comment.