Add debug messages to receipt logic
This commit is contained in:
@@ -30,15 +30,14 @@ module.exports = {
|
||||
// S M T W T F S
|
||||
let db = await client.localDB;
|
||||
const channel = await client.channels.fetch(timer.data.channelId);
|
||||
await channel.send(`Format date last monday ${lastMonday} Format date next monday ${nextMonday}`);
|
||||
|
||||
|
||||
const config = await (await db.prepare(`SELECT weekly_budget, last_date_msg_receipts FROM bot_config`).get());
|
||||
const existingBudget = db.prepare(`SELECT id FROM weekly_budgets WHERE start_date = ?`).get(startDate);
|
||||
|
||||
await channel.send(`\`\`\`SELECT id FROM weekly_budgets WHERE start_date = ${startDate}\`\`\`
|
||||
${JSON.stringify(existingBudget)}`);
|
||||
|
||||
|
||||
if (!existingBudget) {
|
||||
await channel.send(`Format date last monday ${lastMonday} as startDate Format date next monday ${nextMonday} as endDate`);
|
||||
await channel.send(`\`\`\`SELECT id FROM weekly_budgets WHERE start_date = ${startDate}\`\`\`
|
||||
${JSON.stringify(existingBudget)}`);
|
||||
console.log(`No budget found for week starting ${startDate}.`);
|
||||
const response = await fetch(`https://api.frankfurter.dev/v1/latest?amount=1&from=EUR&to=SEK`);
|
||||
|
||||
@@ -76,16 +75,16 @@ module.exports = {
|
||||
LIMIT 1;
|
||||
`).get();
|
||||
|
||||
await channel.send(`\`\`\`SELECT
|
||||
date(last_date_msg_receipts) AS last_date,
|
||||
datetime('now', 'localtime') AS current_time_full,
|
||||
(date(last_date_msg_receipts) = date('now', 'localtime')) AS was_sent_today
|
||||
FROM bot_config
|
||||
LIMIT 1;\`\`\`
|
||||
|
||||
${JSON.stringify(debug)}`);
|
||||
|
||||
|
||||
if (!notification.was_sent_today) {
|
||||
await channel.send(`\`\`\`SELECT
|
||||
date(last_date_msg_receipts) AS last_date,
|
||||
datetime('now', 'localtime') AS current_time_full,
|
||||
(date(last_date_msg_receipts) = date('now', 'localtime')) AS was_sent_today
|
||||
FROM bot_config
|
||||
LIMIT 1;\`\`\`
|
||||
|
||||
${JSON.stringify(debug)}`);
|
||||
const currentDate = new Date().toLocaleDateString('en-GB', {
|
||||
weekday: 'long',
|
||||
day: '2-digit',
|
||||
|
||||
Reference in New Issue
Block a user