CI Status: | Latest CI runs - Link |
---|
This bot is built as an integration to THX Network.
Some of bot's features:
- Admins of Telegram channels can invite bot to their channel and configure THX integration using
/register_channel
command - Admins can set reward for some specific actions users are doing
/rewards
- Admins can setup minimum entrance:
/entrance
amount of tokens to the channel. Those users who enter and don't have that amount will be kicked out - Users of telegram channels(that admins preconfigured) can signup, update their wallets and receive one-time login links to THX wallet app
- Users of telegram channels can complete Know Your User survey and receive one time rewards by completing it.
- Invite THX Bot to your group and give it admin rights
- Hit
/setup
command and you will see this message with a link to the bot:
This is how you contextualize bot usage and how you let bot know what channel you are configuring 3. After that you will be redirected to bot and will see a list of commands like this:
- Hit
register_channel
and fill all information asked by copypasting addresses and secrets from your THX pool dashboard - After that you have two options: you can enable rewards for users who introduced themselves in a group or setup a minimum entrance balance. You can even configure to use both of these features at the same time
-
Hit
/setup
command and you will see message as from above -
Redirect to the bot private channel
-
Now you have two options:
- You either create a new THX wallet for youself by hitting
/create_wallet
- Or hit
/add_me_to_pool
and fill up your existing THX wallet address
- You either create a new THX wallet for youself by hitting
-
You are all set and you can start receiving rewards
In this project security was taken as a first priority. All bot commands are wrapped into valitador-decorator functions that are checking if user or admin are signed in, if channel is properly configured or if user has given a reward already, so they cannot spam rewards infinitely.
All settings and setups are happening in bot private chat that keeps certain context for the channel that you was redirected from. There is no way you can trick the bot by trying to acquire rewards for the channel that you are not member of.
To run this bot locally:
- Talk to Botfather and register your new bot. After everything is done, Botfather will give you bot token
- Create .env file in project root and fill following ENV variables:
BOT_TOKEN
with token that you received from Botfather during step1;MONGODB_USERNAME
,MONGODB_PASSWORD
andMONGODB_HOSTNAME
;SECRET_KEY
that can be generated usingcryptography.Fernet
. Example of .env file:
MONGODB_DATABASE=thx_integration
MONGODB_USERNAME=root
MONGODB_PASSWORD=my_pwd
MONGODB_HOSTNAME=mongodb
SECRET_KEY=<SECRET_KEY>
- Run
docker-compose build
- Run
docker-compose up
You are all set!