Add debug messages to receipt logic

This commit is contained in:
2026-01-26 10:03:45 +01:00
parent bbfb3bfae1
commit 7ca4b47ba9

View File

@@ -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);
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)}`);
if (!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,6 +75,8 @@ module.exports = {
LIMIT 1;
`).get();
if (!notification.was_sent_today) {
await channel.send(`\`\`\`SELECT
date(last_date_msg_receipts) AS last_date,
datetime('now', 'localtime') AS current_time_full,
@@ -84,8 +85,6 @@ module.exports = {
LIMIT 1;\`\`\`
${JSON.stringify(debug)}`);
if (!notification.was_sent_today) {
const currentDate = new Date().toLocaleDateString('en-GB', {
weekday: 'long',
day: '2-digit',