privateReminders: debug logging to figure out what broke in the last month
This commit is contained in:
parent
3660d1c077
commit
79fd9a2210
1 changed files with 17 additions and 11 deletions
|
@ -10,10 +10,12 @@ private_reminders.json example:
|
||||||
]
|
]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const timer = require("../lib/timer");
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const {resolve} = require("path");
|
const {resolve} = require("path");
|
||||||
|
|
||||||
|
const timer = require("../lib/timer");
|
||||||
|
const logger = require("../lib/logger");
|
||||||
|
|
||||||
if (!fs.existsSync(resolve(__dirname, "..", "..", "private_reminders.json")))
|
if (!fs.existsSync(resolve(__dirname, "..", "..", "private_reminders.json")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -91,16 +93,20 @@ hf.bot.once("ready", () => {
|
||||||
minutes = parseInt(minutes);
|
minutes = parseInt(minutes);
|
||||||
const lastRan = new Date(await getLastRun(data.user)).getTime();
|
const lastRan = new Date(await getLastRun(data.user)).getTime();
|
||||||
|
|
||||||
if (
|
if (date > lastRan && hour == data.hour && minutes == 0) {
|
||||||
date > lastRan &&
|
logger.verbose(
|
||||||
hour == data.hour &&
|
"privateReminders",
|
||||||
minutes == 0 &&
|
`attempting to send reminder to ${data.user}`
|
||||||
channel != null
|
);
|
||||||
) {
|
if (channel != null) {
|
||||||
await channel.createMessage({
|
await channel.createMessage({
|
||||||
content: ":alarm_clock: " + data.message,
|
content: ":alarm_clock: " + data.message,
|
||||||
});
|
});
|
||||||
await setLastRun(data.user, date);
|
await setLastRun(data.user, date);
|
||||||
|
logger.verbose("privateReminders", "successfully sent");
|
||||||
|
} else {
|
||||||
|
logger.verbose("privateReminders", "dm channel is null");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue