Skip to content

Commit

Permalink
Merge pull request #13 from backjonas/add-payment-info-to-info-message
Browse files Browse the repository at this point in the history
Add payment info to info message
  • Loading branch information
backjonas authored Dec 11, 2024
2 parents ff6fea1 + 224c4a4 commit ee13b1a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 41 deletions.
50 changes: 18 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions src/admin/saldo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ import {
import { createCsv, formatTransaction } from '../utils.js'
import { config } from '../config.js'
import { ContextWithScenes } from '../scene.js'
import { formattedAccountString } from '../constants.js'

//#region Misc

const bot = new Composer<ContextWithScenes>()

const formattedAccountString =
'<pre>' +
`Mottagare: ${config.bankAccount.name}\n` +
`Kontonummer: ${config.bankAccount.number}\n` +
`Referensnummer: ${config.bankAccount.ref}\n` +
'</pre>'

//endregion

//#region Export
Expand Down
8 changes: 8 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { config } from './config.js'

export const formattedAccountString =
'<pre>' +
`Mottagare: ${config.bankAccount.name}\n` +
`Kontonummer: ${config.bankAccount.number}\n` +
`Referensnummer: ${config.bankAccount.ref}\n` +
'</pre>'
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
formatDateToString,
formatName,
} from './utils.js'
import { formattedAccountString } from './constants.js'

const bot = new Telegraf<ContextWithScenes>(config.botToken)

Expand Down Expand Up @@ -334,17 +335,19 @@ bot.command('kop_ovrigt', async (ctx) => {

//#region Misc commands

const formattedInfoString = config.infoMessage + '\n' + formattedAccountString

bot.command('saldo', async (ctx) => {
const balance = await getBalanceForMember(ctx.from.id)
return ctx.reply(`Ditt saldo är ${balance}€`)
})

bot.command('info', async (ctx) => {
return ctx.reply(config.infoMessage)
return ctx.reply(formattedInfoString, { parse_mode: 'HTML' })
})

bot.command('start', async (ctx) => {
return ctx.reply(config.infoMessage)
return ctx.reply(formattedInfoString, { parse_mode: 'HTML' })
})

bot.telegram.setMyCommands([
Expand Down

0 comments on commit ee13b1a

Please sign in to comment.