This repository hosts the code of @TipAlphBot, a bot that allows you to send and receive Alephium with Telegram!
This project was developed as part of the Alephium Hackathon.
This project uses Node lts/hydrogen (v18.19.0) and NPM (v10.2.3).
To be added soon.
The only supported way to deploy the code actually is using Docker, as the code uses Docker secrets.
To deploy the bot:
git clone https://github.com/notrustverify/tipALPH
.env.example
into .env
file: cp .env.example .env
.env
file according to your setup (fullnode address, …) and insert the bot token and the address for fees in the .env
filebot_mnemonic.txt
in the secrets
foldernpm run package
docker compose --profile tipalph up -d
to run the fresh docker image.On the logs (with docker compose --profile tipalph logs -f
), you should see a successful connection to the database as well as a ready and synced NodeProvider.
The telegram bot should now be available.
To work on the bot, we suggest to use the devnet. It allows for faster testing and better testing conditions (easier generation of tokens).
Follow the same procedure as for deployment, but specify a fullnode on the testnet and "NETWORK=testnet" in the .env file. The provided fees collection address and mnemonic for the wallets should also be on the testnet. We would advise you to use a different database as well, if you previously deployed on a database.
There is multiple way of running the code application:
npm run start
: will transpile the Typescript into Javacript and use node to execute itnpm run dev
: will directly execute the Typescript code using tsx
npm run watch
: as npm run dev
but in watch mode (will reload the program if a file changed or ENTER is pressed)These are defined in the package.json file.
Before running the test suite, you need to have a fullnode on the devnet accessible to http://127.0.0.1:22973
.
The easiest way to do it is to start a docker container before running the test suite. This can be simply archived by running: docker compose --profile test up -d
and waiting some seconds.
Tests can be run using npm run test
.
To add coverage, edit the jest.config.cjs
file and set collectCoverage
to true
;
We wrote some code to test the alephium client that our bot uses, to ensure that we correctly use it.
It seems to be really complicated to test Telegram bots (integration tests, by sending Telegram messages). If you know how to do it, please reach out to us or do a PR!
We provide a Dockerfile to build the container. The easiest way to build a new image is by running the npm run package
commands, which takes care of settings the appropriate tags for you.
To create a docker container from the freshly built image, we recommend using the provided docker-compose.yml file with the required configuration. Once you provided the required dependencies, simply do a docker compose --profile tipalph up
to spin a new container.
The code in this repository (without the dependencies it relies on), is released under the GNU GENERAL PUBLIC LICENSE v3 or later license.