From 32169bd2c21e1a5c2ed4b8664ca5d7fdea6a6ea1 Mon Sep 17 00:00:00 2001 From: Wikinger1988 <69692474+Wikinger1988@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:49:02 +0200 Subject: [PATCH 1/7] Create README.md --- plugins/valorant-stats/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/valorant-stats/README.md diff --git a/plugins/valorant-stats/README.md b/plugins/valorant-stats/README.md new file mode 100644 index 00000000..011ab587 --- /dev/null +++ b/plugins/valorant-stats/README.md @@ -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 + +`example: !valorant-stats 1Matrix1#1111` + +## Requirements: From 83e4eb73f4d1ee50878e9738fa4edf8ac5c2ccb8 Mon Sep 17 00:00:00 2001 From: Wikinger1988 <69692474+Wikinger1988@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:50:21 +0200 Subject: [PATCH 2/7] Add files via upload --- plugins/valorant-stats/valorant-stats.js | 59 ++++++++++++++++++++++ plugins/valorant-stats/valorant-stats.json | 3 ++ 2 files changed, 62 insertions(+) create mode 100644 plugins/valorant-stats/valorant-stats.js create mode 100644 plugins/valorant-stats/valorant-stats.json diff --git a/plugins/valorant-stats/valorant-stats.js b/plugins/valorant-stats/valorant-stats.js new file mode 100644 index 00000000..f3e6cec0 --- /dev/null +++ b/plugins/valorant-stats/valorant-stats.js @@ -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")); + } +}; \ No newline at end of file diff --git a/plugins/valorant-stats/valorant-stats.json b/plugins/valorant-stats/valorant-stats.json new file mode 100644 index 00000000..6bbb9d91 --- /dev/null +++ b/plugins/valorant-stats/valorant-stats.json @@ -0,0 +1,3 @@ +{ + "active": true +} From 2d11bb5ff46c5efb0bb8cc9ed96d499a0e8a0e11 Mon Sep 17 00:00:00 2001 From: Wikinger1988 <69692474+Wikinger1988@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:51:27 +0200 Subject: [PATCH 3/7] Update de.json --- localization/de.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/localization/de.json b/localization/de.json index 197eef29..98d0ef2b 100644 --- a/localization/de.json +++ b/localization/de.json @@ -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", From eb4c3e213948abb0fd206d51b6ba74d4da1f7900 Mon Sep 17 00:00:00 2001 From: Wikinger1988 <69692474+Wikinger1988@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:52:20 +0200 Subject: [PATCH 4/7] Update en.json --- localization/en.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/localization/en.json b/localization/en.json index 8ee84219..9b6f57a7 100644 --- a/localization/en.json +++ b/localization/en.json @@ -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", From 479d9af6e0c69f98b4998c289eba82b895fff48f Mon Sep 17 00:00:00 2001 From: Wikinger1988 <69692474+Wikinger1988@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:54:05 +0200 Subject: [PATCH 5/7] Update valorant-stats.json --- plugins/valorant-stats/valorant-stats.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/valorant-stats/valorant-stats.json b/plugins/valorant-stats/valorant-stats.json index 6bbb9d91..156c781a 100644 --- a/plugins/valorant-stats/valorant-stats.json +++ b/plugins/valorant-stats/valorant-stats.json @@ -1,3 +1,3 @@ { - "active": true + "active": false } From 2a5278278275f683e50887a8f07f7235554c1ee9 Mon Sep 17 00:00:00 2001 From: Wikinger1988 <69692474+Wikinger1988@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:56:28 +0200 Subject: [PATCH 6/7] Update valorant-stats.js --- plugins/valorant-stats/valorant-stats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/valorant-stats/valorant-stats.js b/plugins/valorant-stats/valorant-stats.js index f3e6cec0..72db8cbe 100644 --- a/plugins/valorant-stats/valorant-stats.js +++ b/plugins/valorant-stats/valorant-stats.js @@ -56,4 +56,4 @@ module.exports = { deactivate() { Bot.log(Bot.translate("plugins.valorant.deactivated")); } -}; \ No newline at end of file +}; From 97b6e8c16b25422235ead5ec7f07e5b9660400a3 Mon Sep 17 00:00:00 2001 From: Wikinger1988 <69692474+Wikinger1988@users.noreply.github.com> Date: Thu, 22 Oct 2020 17:00:35 +0200 Subject: [PATCH 7/7] Update es.json --- localization/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localization/es.json b/localization/es.json index b487b55a..6c8898ad 100644 --- a/localization/es.json +++ b/localization/es.json @@ -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",