From 6f63b454b4e236c7118db49b50a4b8b110ebe3ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20B=C3=A4ck?= Date: Tue, 10 Dec 2024 19:42:52 +0200 Subject: [PATCH 1/6] Remove workspaces --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index c806451..3d326d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: spikenbot build: . restart: on-failure - env_file: .env + env_file: .env.docker depends_on: - db networks: From fe8f12aeb7a1b612cab2f4deee36ff1aa272f21a Mon Sep 17 00:00:00 2001 From: christiansegercrantz <44305721+christiansegercrantz@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:45:14 +0000 Subject: [PATCH 2/6] Add payment info to info message --- docker-compose.yml | 2 +- src/admin/saldo.ts | 8 +------- src/constants.ts | 8 ++++++++ src/index.ts | 16 ++++++++++++++-- 4 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 src/constants.ts diff --git a/docker-compose.yml b/docker-compose.yml index 3d326d0..c806451 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: spikenbot build: . restart: on-failure - env_file: .env.docker + env_file: .env depends_on: - db networks: diff --git a/src/admin/saldo.ts b/src/admin/saldo.ts index 90dda7b..b8855af 100644 --- a/src/admin/saldo.ts +++ b/src/admin/saldo.ts @@ -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() -const formattedAccountString = - '
' +
-  `Mottagare: ${config.bankAccount.name}\n` +
-  `Kontonummer: ${config.bankAccount.number}\n` +
-  `Referensnummer: ${config.bankAccount.ref}\n` +
-  '
' - //endregion //#region Export diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..67e523f --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,8 @@ +import { config } from './config.js' + +export const formattedAccountString = + '
' +
+  `Mottagare: ${config.bankAccount.name}\n` +
+  `Kontonummer: ${config.bankAccount.number}\n` +
+  `Referensnummer: ${config.bankAccount.ref}\n` +
+  '
' diff --git a/src/index.ts b/src/index.ts index 84ede3d..2354278 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,9 @@ import { formatDateToString, formatName, } from './utils.js' +import { formattedAccountString } from './constants.js' + + const bot = new Telegraf(config.botToken) @@ -334,17 +337,26 @@ bot.command('kop_ovrigt', async (ctx) => { //#region Misc commands +const formattedInfoString = config.infoMessage.replace( + '{}', + 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) }) bot.telegram.setMyCommands([ From 9f62cac39b17556a95e7a9b9208389014a1102c5 Mon Sep 17 00:00:00 2001 From: christiansegercrantz <44305721+christiansegercrantz@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:47:07 +0000 Subject: [PATCH 3/6] Fix type dependencies --- package-lock.json | 234 +++++++++++++++++++++++++++++++++++++++------- package.json | 3 + 2 files changed, 205 insertions(+), 32 deletions(-) diff --git a/package-lock.json b/package-lock.json index bc1c216..3c118e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,35 @@ { - "name": "spiken", + "name": "spiken-backend", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "spiken", + "name": "spiken-backend", "version": "1.0.0", "license": "ISC", - "workspaces": [ - "backend", - "db" - ] + "dependencies": { + "csv-parse": "^5.5.5", + "dotenv": "^16.3.1", + "pg": "^8.11.3", + "telegraf": "^4.14.0", + "zod": "^3.22.4" + }, + "devDependencies": { + "@types/debug": "^4.1.12", + "@types/node": "^20.8.4", + "@types/node-fetch": "^2.6.12", + "@types/pg": "^8.10.5", + "@types/safe-compare": "^1.1.2", + "prettier": "3.0.3", + "tsc-watch": "^6.0.4", + "typescript": "^5.2.2" + } }, "backend": { "name": "spiken-backend", "version": "1.0.0", + "extraneous": true, "license": "ISC", "dependencies": { "csv-parse": "^5.5.5", @@ -35,6 +49,7 @@ "db": { "name": "spiken-db", "version": "1.0.0", + "extraneous": true, "license": "ISC" }, "node_modules/@telegraf/types": { @@ -42,6 +57,23 @@ "resolved": "https://registry.npmjs.org/@telegraf/types/-/types-6.9.1.tgz", "integrity": "sha512-bzqwhicZq401T0e09tu8b1KvGfJObPmzKU/iKCT5V466AsAZZWQrBYQ5edbmD1VZuHLEwopoOVY5wPP4HaLtug==" }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/ms": { + "version": "0.7.34", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", + "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "20.8.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.4.tgz", @@ -51,6 +83,17 @@ "undici-types": "~5.25.1" } }, + "node_modules/@types/node-fetch": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, "node_modules/@types/pg": { "version": "8.10.5", "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.5.tgz", @@ -119,6 +162,13 @@ "node": ">=12" } }, + "node_modules/@types/safe-compare": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@types/safe-compare/-/safe-compare-1.1.2.tgz", + "integrity": "sha512-kK/IM1+pvwCMom+Kezt/UlP8LMEwm8rP6UgGbRc6zUnhU/csoBQ5rWgmD2CJuHxiMiX+H1VqPGpo0kDluJGXYA==", + "dev": true, + "license": "MIT" + }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -130,6 +180,13 @@ "node": ">=6.5" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, "node_modules/buffer-alloc": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", @@ -157,6 +214,19 @@ "node": ">=4" } }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -192,6 +262,16 @@ } } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/dotenv": { "version": "16.3.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", @@ -232,6 +312,21 @@ "node": ">=6" } }, + "node_modules/form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/from": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", @@ -250,6 +345,29 @@ "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==", "dev": true }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -525,14 +643,6 @@ "node": ">=8" } }, - "node_modules/spiken-backend": { - "resolved": "backend", - "link": true - }, - "node_modules/spiken-db": { - "resolved": "db", - "link": true - }, "node_modules/split": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", @@ -695,6 +805,21 @@ "resolved": "https://registry.npmjs.org/@telegraf/types/-/types-6.9.1.tgz", "integrity": "sha512-bzqwhicZq401T0e09tu8b1KvGfJObPmzKU/iKCT5V466AsAZZWQrBYQ5edbmD1VZuHLEwopoOVY5wPP4HaLtug==" }, + "@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "dev": true, + "requires": { + "@types/ms": "*" + } + }, + "@types/ms": { + "version": "0.7.34", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", + "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==", + "dev": true + }, "@types/node": { "version": "20.8.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.4.tgz", @@ -704,6 +829,16 @@ "undici-types": "~5.25.1" } }, + "@types/node-fetch": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==", + "dev": true, + "requires": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, "@types/pg": { "version": "8.10.5", "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.5.tgz", @@ -759,6 +894,12 @@ } } }, + "@types/safe-compare": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@types/safe-compare/-/safe-compare-1.1.2.tgz", + "integrity": "sha512-kK/IM1+pvwCMom+Kezt/UlP8LMEwm8rP6UgGbRc6zUnhU/csoBQ5rWgmD2CJuHxiMiX+H1VqPGpo0kDluJGXYA==", + "dev": true + }, "abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -767,6 +908,12 @@ "event-target-shim": "^5.0.0" } }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, "buffer-alloc": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", @@ -791,6 +938,15 @@ "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==" }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -815,6 +971,12 @@ "ms": "2.1.2" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true + }, "dotenv": { "version": "16.3.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", @@ -846,6 +1008,17 @@ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" }, + "form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "from": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", @@ -864,6 +1037,21 @@ "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==", "dev": true }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "requires": { + "mime-db": "1.52.0" + } + }, "mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -1059,24 +1247,6 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, - "spiken-backend": { - "version": "file:backend", - "requires": { - "@types/node": "^20.8.4", - "@types/pg": "^8.10.5", - "csv-parse": "^5.5.5", - "dotenv": "^16.3.1", - "pg": "^8.11.3", - "prettier": "3.0.3", - "telegraf": "^4.14.0", - "tsc-watch": "^6.0.4", - "typescript": "^5.2.2", - "zod": "^3.22.4" - } - }, - "spiken-db": { - "version": "file:db" - }, "split": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", diff --git a/package.json b/package.json index e20a72a..5934fb3 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,11 @@ "license": "ISC", "type": "module", "devDependencies": { + "@types/debug": "^4.1.12", "@types/node": "^20.8.4", + "@types/node-fetch": "^2.6.12", "@types/pg": "^8.10.5", + "@types/safe-compare": "^1.1.2", "prettier": "3.0.3", "tsc-watch": "^6.0.4", "typescript": "^5.2.2" From 4ec5f18068a2a5825f2a0d5784f6c6e82e486b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20B=C3=A4ck?= Date: Wed, 11 Dec 2024 09:47:59 +0200 Subject: [PATCH 4/6] Remove unused dev dependencies --- package-lock.json | 184 ---------------------------------------------- package.json | 3 - 2 files changed, 187 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3c118e5..d8ebfbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,11 +16,8 @@ "zod": "^3.22.4" }, "devDependencies": { - "@types/debug": "^4.1.12", "@types/node": "^20.8.4", - "@types/node-fetch": "^2.6.12", "@types/pg": "^8.10.5", - "@types/safe-compare": "^1.1.2", "prettier": "3.0.3", "tsc-watch": "^6.0.4", "typescript": "^5.2.2" @@ -57,23 +54,6 @@ "resolved": "https://registry.npmjs.org/@telegraf/types/-/types-6.9.1.tgz", "integrity": "sha512-bzqwhicZq401T0e09tu8b1KvGfJObPmzKU/iKCT5V466AsAZZWQrBYQ5edbmD1VZuHLEwopoOVY5wPP4HaLtug==" }, - "node_modules/@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/ms": "*" - } - }, - "node_modules/@types/ms": { - "version": "0.7.34", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", - "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/node": { "version": "20.8.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.4.tgz", @@ -83,17 +63,6 @@ "undici-types": "~5.25.1" } }, - "node_modules/@types/node-fetch": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz", - "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "form-data": "^4.0.0" - } - }, "node_modules/@types/pg": { "version": "8.10.5", "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.5.tgz", @@ -162,13 +131,6 @@ "node": ">=12" } }, - "node_modules/@types/safe-compare": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@types/safe-compare/-/safe-compare-1.1.2.tgz", - "integrity": "sha512-kK/IM1+pvwCMom+Kezt/UlP8LMEwm8rP6UgGbRc6zUnhU/csoBQ5rWgmD2CJuHxiMiX+H1VqPGpo0kDluJGXYA==", - "dev": true, - "license": "MIT" - }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -180,13 +142,6 @@ "node": ">=6.5" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true, - "license": "MIT" - }, "node_modules/buffer-alloc": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", @@ -214,19 +169,6 @@ "node": ">=4" } }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -262,16 +204,6 @@ } } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/dotenv": { "version": "16.3.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", @@ -312,21 +244,6 @@ "node": ">=6" } }, - "node_modules/form-data": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", - "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", - "dev": true, - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/from": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", @@ -345,29 +262,6 @@ "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==", "dev": true }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -805,21 +699,6 @@ "resolved": "https://registry.npmjs.org/@telegraf/types/-/types-6.9.1.tgz", "integrity": "sha512-bzqwhicZq401T0e09tu8b1KvGfJObPmzKU/iKCT5V466AsAZZWQrBYQ5edbmD1VZuHLEwopoOVY5wPP4HaLtug==" }, - "@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", - "dev": true, - "requires": { - "@types/ms": "*" - } - }, - "@types/ms": { - "version": "0.7.34", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", - "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==", - "dev": true - }, "@types/node": { "version": "20.8.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.4.tgz", @@ -829,16 +708,6 @@ "undici-types": "~5.25.1" } }, - "@types/node-fetch": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz", - "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==", - "dev": true, - "requires": { - "@types/node": "*", - "form-data": "^4.0.0" - } - }, "@types/pg": { "version": "8.10.5", "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.5.tgz", @@ -894,12 +763,6 @@ } } }, - "@types/safe-compare": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@types/safe-compare/-/safe-compare-1.1.2.tgz", - "integrity": "sha512-kK/IM1+pvwCMom+Kezt/UlP8LMEwm8rP6UgGbRc6zUnhU/csoBQ5rWgmD2CJuHxiMiX+H1VqPGpo0kDluJGXYA==", - "dev": true - }, "abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -908,12 +771,6 @@ "event-target-shim": "^5.0.0" } }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true - }, "buffer-alloc": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", @@ -938,15 +795,6 @@ "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==" }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -971,12 +819,6 @@ "ms": "2.1.2" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true - }, "dotenv": { "version": "16.3.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", @@ -1008,17 +850,6 @@ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" }, - "form-data": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", - "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, "from": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", @@ -1037,21 +868,6 @@ "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==", "dev": true }, - "mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true - }, - "mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "requires": { - "mime-db": "1.52.0" - } - }, "mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", diff --git a/package.json b/package.json index 5934fb3..e20a72a 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,8 @@ "license": "ISC", "type": "module", "devDependencies": { - "@types/debug": "^4.1.12", "@types/node": "^20.8.4", - "@types/node-fetch": "^2.6.12", "@types/pg": "^8.10.5", - "@types/safe-compare": "^1.1.2", "prettier": "3.0.3", "tsc-watch": "^6.0.4", "typescript": "^5.2.2" From 6c202a6d9ad66acbcb6d3e4793fed623c6d433a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20B=C3=A4ck?= Date: Wed, 11 Dec 2024 09:59:31 +0200 Subject: [PATCH 5/6] Append payment information to info message --- src/index.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2354278..12f8f1c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,8 +20,6 @@ import { } from './utils.js' import { formattedAccountString } from './constants.js' - - const bot = new Telegraf(config.botToken) bot.use(async (ctx, next) => { @@ -337,10 +335,7 @@ bot.command('kop_ovrigt', async (ctx) => { //#region Misc commands -const formattedInfoString = config.infoMessage.replace( - '{}', - formattedAccountString -) +const formattedInfoString = config.infoMessage + '\n' + formattedAccountString bot.command('saldo', async (ctx) => { const balance = await getBalanceForMember(ctx.from.id) @@ -348,13 +343,9 @@ bot.command('saldo', async (ctx) => { }) bot.command('info', async (ctx) => { - return ctx.reply(formattedInfoString, - { parse_mode: 'HTML' } - ) + return ctx.reply(formattedInfoString, { parse_mode: 'HTML' }) }) - - bot.command('start', async (ctx) => { return ctx.reply(formattedInfoString) }) From 224c4a46d2dae64e108680e144c99be7a3ea90e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20B=C3=A4ck?= Date: Wed, 11 Dec 2024 10:01:17 +0200 Subject: [PATCH 6/6] Use HTML parse_mode for start command --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 12f8f1c..8165b67 100644 --- a/src/index.ts +++ b/src/index.ts @@ -347,7 +347,7 @@ bot.command('info', async (ctx) => { }) bot.command('start', async (ctx) => { - return ctx.reply(formattedInfoString) + return ctx.reply(formattedInfoString, { parse_mode: 'HTML' }) }) bot.telegram.setMyCommands([