diff --git a/src/class/Client.ts b/src/class/Client.ts index d117ff0..5753a09 100644 --- a/src/class/Client.ts +++ b/src/class/Client.ts @@ -46,7 +46,7 @@ export default class Client extends eris.Client { await (new this.db.Stat({ name: 'pages', value: 0 }).save()); } if (!statRequests) { - await (new this.db.Stat({ name: 'requests' }).save()); + await (new this.db.Stat({ name: 'requests', value: 0 }).save()); } } diff --git a/src/class/Route.ts b/src/class/Route.ts index 97a24d0..0d90eaa 100644 --- a/src/class/Route.ts +++ b/src/class/Route.ts @@ -20,7 +20,7 @@ export default class Route { public init() { this.router.all('*', (req, res, next) => { this.server.client.util.signale.log(`'${req.method}' request from '${req.ip}' to '${req.hostname}${req.path}'.`); - this.server.client.db.Stat.updateOne({ name: 'requests' }, { $inc: { value: 1 } }); + this.server.client.db.Stat.updateOne({ name: 'requests' }, { $inc: { value: 1 } }).exec(); if (this.conf.maintenance === true) res.status(503).json({ code: this.constants.codes.MAINTENANCE_OR_UNAVAILABLE, message: this.constants.messages.MAINTENANCE_OR_UNAVAILABLE }); else if (this.conf.deprecated === true) res.status(501).json({ code: this.constants.codes.DEPRECATED, message: this.constants.messages.DEPRECATED }); else next(); diff --git a/src/commands/index.ts b/src/commands/index.ts index 614abd0..3b77616 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -19,6 +19,7 @@ export { default as page } from './page'; export { default as ping } from './ping'; export { default as rank } from './rank'; export { default as roleinfo } from './roleinfo'; +export { default as stats } from './stats'; export { default as storemessages } from './storemessages'; export { default as unban } from './unban'; export { default as unmute } from './unmute'; diff --git a/src/commands/page.ts b/src/commands/page.ts index 1f5e398..dd60b54 100644 --- a/src/commands/page.ts +++ b/src/commands/page.ts @@ -146,7 +146,7 @@ export default class Page extends Command { html: `

Page

${options?.emergencyNumber ? `

[SEN#${options.emergencyNumber}]` : ''}Recipient PN: ${recipientNumber}
Sender PN: ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})
Initial Command: https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)

Pager Code: ${code} (${this.local.codeDict.get(code)})${txt ? `
Message: ${txt}` : ''}`, }); } - this.client.db.Stat.updateOne({ name: 'pages' }, { $inc: { value: 1 } }); + this.client.db.Stat.updateOne({ name: 'pages' }, { $inc: { value: 1 } }).exec(); return { status: true, message: `Page to \`${recipientNumber}\` sent.` }; } catch (err) { this.client.util.signale.error(err); diff --git a/src/events/CommandHandler.ts b/src/events/CommandHandler.ts index 176b0ac..c563175 100644 --- a/src/events/CommandHandler.ts +++ b/src/events/CommandHandler.ts @@ -12,7 +12,7 @@ export default class CommandHandler extends Event { public async run(message: Message) { try { - this.client.db.Stat.updateOne({ name: 'messages' }, { $inc: { value: 1 } }); + this.client.db.Stat.updateOne({ name: 'messages' }, { $inc: { value: 1 } }).exec(); if (message.author.bot) return; if (message.content.indexOf(this.client.config.prefix) !== 0) return; const noPrefix: string[] = message.content.slice(this.client.config.prefix.length).trim().split(/ +/g); @@ -26,7 +26,7 @@ export default class CommandHandler extends Event { } this.client.util.signale.log(`User '${message.author.username}#${message.author.discriminator}' ran command '${resolved.cmd.name}' in '${message.channel.id}'.`); await resolved.cmd.run(message, resolved.args); - this.client.db.Stat.updateOne({ name: 'commands' }, { $inc: { value: 1 } }); + this.client.db.Stat.updateOne({ name: 'commands' }, { $inc: { value: 1 } }).exec(); } catch (err) { this.client.util.handleError(err, message); }