Files
simplex-chat/apps/simplex-calculator-bot
sh f65c2da587 nodejs: lazy per-backend libsimplex download (#7543)
* ci: drop dlltool from nodejs libs release

* nodejs: download libsimplex into the user cache

* nodejs: load libsimplex at runtime per backend

* support bot: select db backend with --db

* python: match backend switch error text

* nodejs: download prebuilt add-on at runtime

* ci: build nodejs add-on for libs release

* calculator bot: load libs and add-on in image

* support bot: document add-on override

* nodejs: keep worker test output free of colors

* nodejs: verify sha-256 of downloaded assets

* python: pin core libs release with sha-256

* ci: add packages release script

* ci: release nodejs add-on and open release PR

* ci: publish packages after release PR

* nodejs: keep npm from building the add-on

* calculator bot: build the add-on in the image

* ci: merge package release workflows

* ci: open release PR when publishing fails

* ci: build the add-on with node-addon-api only

* ci: skip publishing in a called packages workflow

* ci: update package release actions to Node 24

* nodejs: fix receive test timeout

* ci: test packages on pull requests

* nodejs: reuse the database in the close stress test

* ci: keep failed package tests from hanging

* ci: skip preset server tests

* ci: plan package builds from the changes

* ci: test packages with a given libsimplex

* ci: test packages with libsimplex of core changes
2026-10-14 09:53:53 +01:00
..

SimpleX Calculator

A calculator bot built with the SimpleX Chat Node.js library.

Each user who connects via the bot's business address receives a calculator message with keys as commands. The bot replaces this message after each input.

  • × and ÷ are applied before + and -, so 2 + 3 × 4 = equals 14.
  • % is computed as in Apple's calculator: 100 + 15 % = equals 115.
  • Tap C to clear the number, and C again to clear the calculation.
  • Numbers are shown without exponent, up to 15 digits; larger results are shown as Error.
  • You can also send numbers and keys like +, =, add or c. Expressions like (2 + 3) × 4 are entered as one number, and the bot replies to them with the result.
  • The bot deletes keys and numbers, tapped or sent, and logs each computed operation, such as 15 + 10 = 25.
  • After 10 minutes without input, the bot turns the calculator off and discards the calculation; tap any key to turn it on.
  • The bot sends keys like /+ to apps with chat protocol version 21 or later, and keys like /add to older apps.

Run

npm install
npm run build
npm start

The bot prints its address and keeps its data in ./data.

To add a SimpleX name to the address, register the name with the address short link, and run npm start -- --domain yourname.simplex. The name is kept when the bot starts without --domain.

To use the library from this repository, build it and run npm install --no-save ../../packages/simplex-chat-nodejs instead of npm install, then start the bot with SIMPLEX_ADDON_PATH=../../packages/simplex-chat-nodejs/build/Release/simplex.node.

Test

npm test

A local SMP server is started for the end-to-end test. On Linux, smp-server is downloaded from simplexmq releases; to use another build, or on other systems, set SMP_SERVER to the path of smp-server.