Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Stat Tracking #351

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions squad-server/plugins/basic-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export default class DiscordStats extends BasePlugin {
if (!message.content.startsWith(prefix)) return;
if (message.author.bot) return;
const cmd = message.content.split(" ")[0].slice(prefix.length);
if (message.channel.id != this.options.channelID) return;
if (message.channel.id !== this.options.channelID) return;
switch (cmd) {
case "link":
{
Expand All @@ -377,7 +377,7 @@ export default class DiscordStats extends BasePlugin {
message.reply("No user found with that steamID");
break;
}
if (this.linkedAccounts.find((x) => x.steamID == steamID || message.author.id == x.discordID)) return message.reply("Account already linked");
if (this.linkedAccounts.find((x) => x.steamID === steamID || message.author.id === x.discordID)) return message.reply("Account already linked");
this.linkedAccounts.push({
discordID: message.author.id,
steamID: steamID
Expand Down Expand Up @@ -648,13 +648,6 @@ export default class DiscordStats extends BasePlugin {
}
});

const tks = await this.models.Death.count({
Josephfallen marked this conversation as resolved.
Show resolved Hide resolved
where: {
attacker: user.steamID,
teamkill: 1
}
});

const matcheCount = await this.models.Death.findOne({
where: {
attacker: user.steamID
Expand Down Expand Up @@ -704,8 +697,6 @@ export default class DiscordStats extends BasePlugin {
});

const kdr = deaths === 0 ? kills : kills / deaths;
const rpd = revives === 0 ? 0 : revives / deaths;
Josephfallen marked this conversation as resolved.
Show resolved Hide resolved
const hpr = hits === 0 ? 0 : hits / revives;

const content = new Discord.MessageEmbed()
.setTitle(`${user.lastName} - ${user.steamID} STATS`)
Expand Down