|
|
@ -46,8 +46,11 @@ async function start(){ |
|
|
|
bot.command(`budget${name.toLowerCase()}`, async ctx => { |
|
|
|
bot.command(`budget${name.toLowerCase()}`, async ctx => { |
|
|
|
if (!isSenderAllowed(ctx.message?.from!)) |
|
|
|
if (!isSenderAllowed(ctx.message?.from!)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
currentBudgetID = id; |
|
|
|
currentBudgetID = id; |
|
|
|
console.log(`Changed current Budget to ${budgets[id]}`) |
|
|
|
console.log(`Changed current Budget to ${budgets[id]}`); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await ctx.react(["👍"]); |
|
|
|
}); |
|
|
|
}); |
|
|
|
budgetCommands.push({ |
|
|
|
budgetCommands.push({ |
|
|
|
command: `budget${name.toLowerCase()}`, |
|
|
|
command: `budget${name.toLowerCase()}`, |
|
|
@ -62,7 +65,7 @@ async function start(){ |
|
|
|
bot.command("currentbudget", async ctx => { |
|
|
|
bot.command("currentbudget", async ctx => { |
|
|
|
if (!isSenderAllowed(ctx.message?.from!)) |
|
|
|
if (!isSenderAllowed(ctx.message?.from!)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
await ctx.reply(currentBudgetID || "No budget selected!"); |
|
|
|
await ctx.reply(budgets[currentBudgetID] || "No budget selected!"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await bot.api.setMyCommands(budgetCommands); |
|
|
|
await bot.api.setMyCommands(budgetCommands); |
|
|
@ -105,6 +108,7 @@ async function start(){ |
|
|
|
|
|
|
|
|
|
|
|
if (res.status === 200){ |
|
|
|
if (res.status === 200){ |
|
|
|
console.log(`Added ${amount} to ${budgets[currentBudgetID]}`); |
|
|
|
console.log(`Added ${amount} to ${budgets[currentBudgetID]}`); |
|
|
|
|
|
|
|
await ctx.react(["👍"]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|