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 {resolve} = require("path");
|
||||
|
||||
const timer = require("../lib/timer");
|
||||
const logger = require("../lib/logger");
|
||||
|
||||
if (!fs.existsSync(resolve(__dirname, "..", "..", "private_reminders.json")))
|
||||
return;
|
||||
|
||||
|
@ -91,16 +93,20 @@ hf.bot.once("ready", () => {
|
|||
minutes = parseInt(minutes);
|
||||
const lastRan = new Date(await getLastRun(data.user)).getTime();
|
||||
|
||||
if (
|
||||
date > lastRan &&
|
||||
hour == data.hour &&
|
||||
minutes == 0 &&
|
||||
channel != null
|
||||
) {
|
||||
await channel.createMessage({
|
||||
content: ":alarm_clock: " + data.message,
|
||||
});
|
||||
await setLastRun(data.user, date);
|
||||
if (date > lastRan && hour == data.hour && minutes == 0) {
|
||||
logger.verbose(
|
||||
"privateReminders",
|
||||
`attempting to send reminder to ${data.user}`
|
||||
);
|
||||
if (channel != null) {
|
||||
await channel.createMessage({
|
||||
content: ":alarm_clock: " + data.message,
|
||||
});
|
||||
await setLastRun(data.user, date);
|
||||
logger.verbose("privateReminders", "successfully sent");
|
||||
} else {
|
||||
logger.verbose("privateReminders", "dm channel is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue