created new logging system, also added logging of commands

This commit is contained in:
ayeuhugyu 2023-09-13 06:59:53 -07:00
parent d18afd63f0
commit 92c9033d1e
3 changed files with 26 additions and 3 deletions

View file

@ -37,7 +37,7 @@ module.exports = {
log(
"forcesay.log",
message,
this.name,
__filename,
`${message.author.username} (${message.author}) attempted to force bot to dm ${user} "${msg}"`
);
ableToSend = false;
@ -49,7 +49,7 @@ module.exports = {
log(
"forcesay.log",
message,
this.name,
__filename,
`${message.author.username} (${message.author}) forced bot to dm ${user.username} (${user}) "${msg}"`
);
}

View file

@ -24,7 +24,7 @@ module.exports = {
log(
"forcesay.log",
message,
this.name,
__filename,
`${message.author.username} (${message.author}) forced bot to say "${msg}"`
);
}

23
src/util/log.js Normal file
View file

@ -0,0 +1,23 @@
const fs = require("fs");
module.exports.execute = function (file, message, from, msg) {
fs.appendFileSync(
`../pepperbot/src/logs/${file}`,
`AT: ${Date()}
SCRIPT: ${from}
FROM: ${message.content}
ADDITIONAL INFORMATION: ${msg}
\n`
);
console.log(
`AT: ${Date()}
SCRIPT: ${from}
FROM: ${message.content}
ADDITIONAL INFORMATION: ${msg}
`
);
};
// TEMPLATE:
// const log = require('../util/log.js').execute()
// log('failed.log', message, __filename, 'additional content')