Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
Fixed a serious bug in the purge command
Browse files Browse the repository at this point in the history
  • Loading branch information
Serena1432 committed Jul 15, 2021
1 parent 7905a9f commit fbbe3ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commands/purge.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function info(client, message, args, language) {
if (waifu.rarity == "Normal") {
var inTeam = false;
if (client.economyManager[message.author.id].team && client.economyManager[message.author.id].team.members.length) {
for (var i = 0; i < client.economyManager[message.author.id].team.members.length; i++) {
for (var j = 0; j < client.economyManager[message.author.id].team.members.length; j++) {
if (client.economyManager[message.author.id].team.members[i] == waifu.id) inTeam = true;
}
}
Expand All @@ -42,7 +42,7 @@ function info(client, message, args, language) {
var team;
eval("team = client.economyManager[message.author.id].team" + c);
if (team && team.members.length) {
for (var i = 0; i < team.members.length; i++) {
for (var j = 0; j < team.members.length; j++) {
if (team.members[i] == waifu.id) return inTeam = true;
}
}
Expand Down
4 changes: 4 additions & 0 deletions web/VoteReceiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ function vote(client, req, res, user, success) {
data: JSON.stringify(client.economyManager[user.id])
}}, function(error, response, body) {
if (!error && response.statusCode == 200 && body.includes("Success")) {
console.log("Success");
user.send("Thank you for voting me " + user.username + "!\nYou have received **" + coinValue.toLocaleString() + " " + client.config.currency + ", 1 Leveling Ticket " + lvt + "★ and 1 Gacha Ticket " + gtk + "★** as a reward!");
res.send({success: true, message: "Action has been done."});
}
else {
console.log("Failed");
var coins = parseInt(decrypt(client.economyManager[user.id].coins));
coins -= coinValue;
client.economyManager[user.id].coins = encrypt(coins.toString());
Expand All @@ -34,6 +36,7 @@ function vote(client, req, res, user, success) {
});
}
else {
console.log("Failed");
user.send("Thank you for voting me " + user.username + "!");
res.send({success: true, message: "Action has been done, but no coins was given due to server error."})
}
Expand All @@ -44,6 +47,7 @@ module.exports.post = function(client, req, res) {
if (process.env.dbl_vote_authorization) {
if (req.headers.authorization != process.env.dbl_vote_authorization) return res.status(401).send({error: 401, message: "Invalid authorization token"});
if (!req.body.user) return res.status(404).send({error: 404, message: "Invalid user."});
console.log(req.body.user);
var user = client.users.cache.get(req.body.user);
if (!user) return res.status(404).send({error: 404, message: "Invalid user."});
if (!client.economyManager || !client.economyManager[user.id]) {
Expand Down

0 comments on commit fbbe3ec

Please sign in to comment.