Add basic receipt logging

This commit is contained in:
2026-01-19 13:53:42 +01:00
parent e5933aacc2
commit e9d795fdf1
5 changed files with 169 additions and 45 deletions

View File

@@ -14,11 +14,21 @@ module.exports = {
option.setName('amount')
.setRequired(true)
.setDescription('Amount as int'))
.addBooleanOption(option =>
option.setName('override')
.setRequired(false)
.setDescription('Override budget of current period'))
)
.addSubcommand(subcommand =>
subcommand
.setName('show')
.setDescription('not implemented')
.setName('spendings')
.setDescription('View your grocery spendings for the current or previous week')
.addBooleanOption(option =>
option
.setName('lastweek')
.setDescription('Show spendings from the previous budget cycle instead of the current one')
.setRequired(false)
)
),
async execute(interaction) {
console.log('budget command entrypoint');
@@ -31,7 +41,7 @@ module.exports = {
console.log('budget command denied');
await interaction.reply('This command may only be invoked by Miffy!');
return;
}
}
console.log(`Switcching on sub ${interaction.options.getSubcommand()}`);
switch (interaction.options.getSubcommand()) {
case 'set':
@@ -40,7 +50,7 @@ module.exports = {
db.prepare(`INSERT OR REPLACE INTO bot_config (id, weekly_budget) VALUES (1, ?)`).run(budget);
await interaction.reply(`Budget set to ${budget}`);
break;
case 'show':
case 'spendings':
console.log('budget command show');
await interaction.reply('Not implemented');
break