Skip to content

Commit

Permalink
v4.13.5 - Bug fix na contagem de comandos
Browse files Browse the repository at this point in the history
  • Loading branch information
alanfilho184 committed Aug 12, 2024
1 parent af8a4f1 commit 66571e8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@ jobs:
cd Kami
rm package-lock.json
git pull
npm prune
npm install
npm audit fix --force
pm2 reload bot
pm2 restart bot
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kami",
"version": "4.13.4",
"version": "4.13.5",
"description": "Um BOT para Discord com foco em ajudar em mesas de RPG online, tendo suas principais funções criar fichas e rolar dados.",
"main": "index.js",
"scripts": {
Expand Down
13 changes: 9 additions & 4 deletions src/resources/config/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ function replaceAll(string, search, replace) {
return splited
}

const commandCount = new Object()

// module.exports = class Cache {
// constructor(client) {
// this.client = client
Expand Down Expand Up @@ -527,6 +525,11 @@ const commandCount = new Object()

// }

const commandCount = new Object({
cmd: 0,
buttons: 0,
})

module.exports = class DirectDB {
constructor(client) {
this.client = client;
Expand Down Expand Up @@ -556,9 +559,9 @@ module.exports = class DirectDB {
const result = await this.client.db.query("select commandcount, buttoncount from info");
return {
total: result[0][0].commandcount,
today: 0,
today: commandCount.cmd,
buttonsTotal: result[0][0].buttoncount,
buttonsToday: 0,
buttonsToday: commandCount.buttons,
};
}

Expand Down Expand Up @@ -625,8 +628,10 @@ module.exports = class DirectDB {

async updateCnt(type) {
if (type === "cmd") {
commandCount.cmd = commandCount.cmd + 1;
await this.client.db.query("update info set commandcount = commandcount + 1");
} else if (type === "button") {
commandCount.buttons = commandCount.buttons + 1;
await this.client.db.query("update info set buttoncount = buttoncount + 1");
}
}
Expand Down

0 comments on commit 66571e8

Please sign in to comment.