Skip to content

Commit

Permalink
Add admin message
Browse files Browse the repository at this point in the history
  • Loading branch information
christiansegercrantz committed Apr 23, 2024
1 parent 60e82fa commit eef70b4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {

/*
Toiveiden tynnyri:
- En 'vapaa myynti' command med description och summa
- Tyhjä
*/

const bot = new Telegraf<ContextWithScenes>(config.botToken)
Expand Down Expand Up @@ -269,7 +269,6 @@ const buyOtherScene = new Scenes.WizardScene<ContextWithScenes>(

const customBuy = ctx.scene.session.customBuy
confirmOrAbortReplyForCustomBuy(ctx, customBuy)
console.log(ctx.scene.session.customBuy)
return ctx.wizard.next()
} catch (e) {
console.log('Error found: ', e)
Expand All @@ -289,6 +288,13 @@ const buyOtherScene = new Scenes.WizardScene<ContextWithScenes>(
description: customBuy.description,
amountCents: customBuy.priceCents,
})

const adminMessage =
`Användare ${formatName(ctx.from!)} köpte custom produkt:\n` +
`\t\t\tVad: ${customBuy.description}\n` +
`\t\t\tPris: ${formatCentsToEuroString(-customBuy.priceCents)}\n`

ctx.telegram.sendMessage(config.adminChatId, adminMessage)
} catch (e) {
console.log('Failed to purchase item:', e)
ctx.reply('Köpet misslyckades, klaga till croupieren')
Expand Down

0 comments on commit eef70b4

Please # to comment.