Budget-notes Telegram bot
Live example here @MemoryManagerBot.
- Create some categories
โโโ ๐ num- "1"
โโโ ๐งธ num- "2"
โ โโโ ๐ "2.1"
โโโ ๐ num- "3"
โ โโโ ๐งฎ "3.1"
โโโ ๐ num- "4"
โโโ โฝ๏ธ "4.1"
- Track some data into categories
- Obtain your monthly(any timeframe) budget
Total: +81,853.7 (+201,564) (-119,710.3)
โโโ ๐: -19,000
โโโ ๐: -18,090
โโโ ๐งธ: -8,247
โโโ ๐: -7,469
โโโ ๐: -19,955.71
โโโ ๐ : -6,319.21
โ โโโ ๐งฎ: -5,541.21
โโโ ๐: -11,459.76
โโโ ๐ช: -7,140.06
โโโ ๐ฝ: -2,635.91
โโโ ๐: -3,712.77
โ โโโ โฝ๏ธ: -3,712.77
โโโ ๐ป: -2,097
โโโ ๐: -8,966.88
โโโ ๐: -4,617
โโโ ๐ฐ: +201,564
Balance till 18.11.2022 12:41:05 is +291,909.88
- Track some text data for whatever reason
Run locally
- install NodeJS, PostgreSQL
- run
npm i
- create
memory
(by default) database forPostgreSQL
- create application at
https://my.telegram.org/apps. Select
application type -
Web
, set -empty URL
, obtainapi id
andapi hash
. - create Telegram Bot with BotFather
- build tdLib for your system, check required version with airgram
- create
.app_rc.json
config file
Build npm run build
and run bot npm start
or cd ./dist
and node app.js
- use bot in private chat or add bot to chat with multiple users (assign bot admin rights to read all messages for better UX)
TbLib vs TelegramBotAPI
TdLib can be used for bot and user. TelegramBotAPI is limited to bots only. Moreover TelegramBotAPI does not support a lot of handy methods, e.g. fetch message by id etc.
- NodeJS+TypeScript has awesome package for TdLib - Airgram.
- NodeJS+TypeScript has awesome package for TelegramBotAPI - Telegraf.
Currently TdLib has only one huge minus for NodeJS - you have to build TdLib, but this can change in the future using WASM.
Config
Configuration file is required. See additional info, about
cosmiconfig package. Configuration
example .app_rc.example.json
. You need to create your own config file e.g.
.app_rc.json
by default.
Environment variables (Debug)
Path to the application config
CONFIG=... node app.js
Debug anything (see all possible values logger.ts)
DEBUG=bnb* node app.js
Tests
For testing you need to have test_section
in config file.
Jest performs tests.
- Run tests
npm run test
- Run unit tests
npm run test-unit
- Run integration tests
npm run test-int