diff --git a/bot/messages.ts b/bot/messages.ts index 8bdf299c..a49ccac7 100644 --- a/bot/messages.ts +++ b/bot/messages.ts @@ -1,5 +1,5 @@ -const { TelegramError } = require('telegraf'); -const QR = require('qrcode'); +import { TelegramError } from 'telegraf' +import QR from 'qrcode'; const { getCurrency, numberFormat, @@ -12,7 +12,7 @@ const { decimalRound, getUserAge, } = require('../util'); -const logger = require('../logger'); +import logger from "../logger"; import { MainContext } from './start'; import { UserDocument } from '../models/user' import { IOrder } from '../models/order' @@ -109,7 +109,7 @@ const invoicePaymentRequestMessage = async ( } }; -const pendingSellMessage = async (ctx: MainContext, user: UserDocument, order: IOrder, channel: string, i18n: I18nContext) => { +const pendingSellMessage = async (ctx: Telegraf, user: UserDocument, order: IOrder, channel: string, i18n: I18nContext) => { try { const orderExpirationWindow = Number(process.env.ORDER_PUBLISHED_EXPIRATION_WINDOW) / 60 / 60; @@ -618,7 +618,7 @@ const publishBuyOrderMessage = async ( }; const publishSellOrderMessage = async ( - ctx: MainContext, + ctx: Telegraf, user: UserDocument, order: IOrder, i18n: I18nContext, @@ -1549,7 +1549,7 @@ const currencyNotSupportedMessage = async (ctx: MainContext, currencies: Array { +const notAuthorized = async (ctx: MainContext, tgId?: string) => { try { if (tgId) { await ctx.telegram.sendMessage(tgId, ctx.i18n.t('not_authorized')); @@ -1606,7 +1606,7 @@ const showConfirmationButtons = async (ctx: MainContext, orders: Array, } }; -module.exports = { +export { startMessage, initBotErrorMessage, invoicePaymentRequestMessage, diff --git a/package-lock.json b/package-lock.json index c7e08854..33ba16ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lnp2pbot", - "version": "0.8.5", + "version": "0.9.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "lnp2pbot", - "version": "0.8.5", + "version": "0.9.2", "license": "MIT", "dependencies": { "@grammyjs/i18n": "^0.5.1", @@ -27,6 +27,7 @@ }, "devDependencies": { "@types/node": "^20.5.0", + "@types/qrcode": "^1.5.2", "chai": "^4.3.4", "chokidar": "^3.5.3", "eslint": "^8.15.0", @@ -1640,6 +1641,15 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.0.tgz", "integrity": "sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==" }, + "node_modules/@types/qrcode": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.2.tgz", + "integrity": "sha512-W4KDz75m7rJjFbyCctzCtRzZUj+PrUHV+YjqDp50sSRezTbrtEAIq2iTzC6lISARl3qw+8IlcCyljdcVJE0Wug==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", @@ -8462,6 +8472,15 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.0.tgz", "integrity": "sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==" }, + "@types/qrcode": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.2.tgz", + "integrity": "sha512-W4KDz75m7rJjFbyCctzCtRzZUj+PrUHV+YjqDp50sSRezTbrtEAIq2iTzC6lISARl3qw+8IlcCyljdcVJE0Wug==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", diff --git a/package.json b/package.json index 382c6827..36deb083 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ ], "devDependencies": { "@types/node": "^20.5.0", + "@types/qrcode": "^1.5.2", "chai": "^4.3.4", "chokidar": "^3.5.3", "eslint": "^8.15.0",