-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from Wikinger1988/patch-1
Added valorant-stats plugin
- Loading branch information
Showing
6 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"active": false | ||
} |