mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-27 22:18:36 +00: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-, so2 + 3 × 4 =equals 14.%is computed as in Apple's calculator:100 + 15 % =equals 115.- Tap
Cto clear the number, andCagain 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
+,=,addorc. Expressions like(2 + 3) × 4are 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/addto older apps.
Run
npm install
npm run build
npm start
The bot prints its address and keeps its data in ./data.
To use the library from this repository, build it and run npm install --no-save ../../packages/simplex-chat-nodejs instead of npm install.
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.