created new logging system, also added logging of commands
This commit is contained in:
parent
cb16a007d3
commit
d18afd63f0
4 changed files with 48 additions and 154 deletions
|
@ -1,4 +1,4 @@
|
|||
const fs = require("fs");
|
||||
const log = require("../util/log.js").execute;
|
||||
|
||||
const prefix = process.env.PREFIX;
|
||||
|
||||
|
@ -34,36 +34,11 @@ module.exports = {
|
|||
message.channel.send(
|
||||
`${message.author}, cannot send message to ${user}, this is usually caused by them not being inside the server`
|
||||
);
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/forcesay.log",
|
||||
Date() +
|
||||
" " +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") attempted to force bot to dm " +
|
||||
user.username +
|
||||
msg +
|
||||
"\n",
|
||||
(err) => {
|
||||
if (err !== null) {
|
||||
console.error(err);
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/errors.log",
|
||||
err + " from: " + message.content + " at " + Date()
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
console.log(
|
||||
Date() +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") attempted to force bot to dm " +
|
||||
user.username +
|
||||
msg +
|
||||
"\n"
|
||||
log(
|
||||
"forcesay.log",
|
||||
message,
|
||||
this.name,
|
||||
`${message.author.username} (${message.author}) attempted to force bot to dm ${user} "${msg}"`
|
||||
);
|
||||
ableToSend = false;
|
||||
});
|
||||
|
@ -71,36 +46,11 @@ module.exports = {
|
|||
message.delete();
|
||||
}
|
||||
if (ableToSend) {
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/forcesay.log",
|
||||
Date() +
|
||||
" " +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") forced bot to dm " +
|
||||
user.username +
|
||||
msg +
|
||||
"\n",
|
||||
(err) => {
|
||||
if (err !== null) {
|
||||
console.error(err);
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/errors.log",
|
||||
err + " from: " + message.content + " at " + Date()
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
console.log(
|
||||
Date() +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") forced bot to dm " +
|
||||
user.username +
|
||||
msg +
|
||||
"\n"
|
||||
log(
|
||||
"forcesay.log",
|
||||
message,
|
||||
this.name,
|
||||
`${message.author.username} (${message.author}) forced bot to dm ${user.username} (${user}) "${msg}"`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const fs = require("fs");
|
||||
const log = require("../util/log.js").execute;
|
||||
|
||||
const prefix = process.env.PREFIX;
|
||||
|
||||
|
@ -21,34 +21,11 @@ module.exports = {
|
|||
if (message.deletable) {
|
||||
message.delete();
|
||||
}
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/forcesay.log",
|
||||
Date() +
|
||||
" " +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") forced bot to say " +
|
||||
msg +
|
||||
"\n",
|
||||
(err) => {
|
||||
if (err !== null) {
|
||||
console.error(err);
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/errors.log",
|
||||
err + " from: " + message.content + " at " + Date()
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
console.log(
|
||||
Date() +
|
||||
" " +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") forced bot to say " +
|
||||
msg
|
||||
log(
|
||||
"forcesay.log",
|
||||
message,
|
||||
this.name,
|
||||
`${message.author.username} (${message.author}) forced bot to say "${msg}"`
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
const log = require("../util/log.js").execute;
|
||||
|
||||
module.exports = {
|
||||
name: "test",
|
||||
description: "test command",
|
||||
execute(message, args) {
|
||||
message.reply("MOTHAFUCKA SHUT UPPPPPP");
|
||||
log("failed.log", message, __filename, "test command");
|
||||
message.reply("log test completed, don't contact me again");
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue