- Notifications
You must be signed in to change notification settings - Fork1
Telegram bot to let validated users of IDENA vote on things
License
Endogen/idena-voting
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
IDENA Telegram Bot is a Telegram bot created by @endogen for the IDENA community.
The bot is build around thepython-telegram-bot module and is polling based.Webhook mode is implemented but untested.
- Every command is a plugin
- Every plugin can be enabled / disabled without restarting the bot
- Every plugin can be updated by drag & dropping the plugin file into the bot chat
- Restart or shutdown the bot via command
- Bot can be used with or without SQLite database
- Bot can be administered by more then one user
- Sending DNA coins to addresses
- Notifications about DNA balance changes
- Generating QR-Code (of address) for deposits
- Enable / disable mining
- Kill your identity
- Import / export identity
- Show info for ceremony, epoch and your identity
- Show enode ID, IP and port
- Show sync status
- Show node version that is being used
- Show your address, balance and stake
- Show transactions (also pending once)
Before starting up the bot you have to take care of some settings and add a Telegram API token. The configuration file and toke file are located in theconfig
folder.
This file holds the configuration for the bot. You have to at least edit the value foradmin_id. Everything else is optional.
- admin - ids: This is a list of Telegram user IDs that will be able to control the bot. You can add your own user or multiple users if you want. If you don't know your Telegram user ID, get in a conversation with Telegram bot@userinfobot and if you write him (anything) he will return you your user ID.
- admin - notify_on_error: If set to
true
then all user IDs in the "admin - ids" list will be notified if some error comes up. - idena - api_key: The API key that your node is using (the value that you provide for the
--apikey=<value>
parameter) - idena - timeout: Timeout value in seconds for the communication with the IDENA node
- idena - host: The hostname that is being used by the remote node. If you run your node locally then
localhost
is what you want to enter - idena - port: The port that is being used by the remote node
- telegram - read_timeout: Read timeout in seconds as integer. Usually this value doesn't have to be changed.
- telegram - connect_timeout: Connect timeout in seconds as integer. Usually this value doesn't have to be changed.
- webhook - listen: Required only for webhook mode. IP to listen to.
- webhook - port: Required only for webhook mode. Port to listen on.
- webhook - privkey_path: Required only for webhook mode. Path to private key (.pem file).
- webhook - cert_path: Required only for webhook mode. Path to certificate (.pem file).
- webhook - url: Required only for webhook mode. URL under which the bot is hosted.
- database -use_db: If
true
then new database files (SQLite) will be created if a plugin tries to execute some SQL statements. Iffalse
, no databases will be used.
This file holds the Telegram bot token. You have to provide one and you will get it in a conversation with Telegram bot@BotFather while registering your bot.
If you don't want to provide the token in a file then you have two other options:
- Provide it as a command line argument while starting your bot:
-tkn <your token>
- Provide it as an command line input (MOST SECURE):
--input-tkn
In order to run the bot you need to execute it with the Python interpreter. If you don't have any idea where to host the bot, take a look atWhere to host Telegram Bots. Services likeHeroku (free) will work fine. You can also run the script locally on your own computer for testing purposes.
You have to use at leastPython 3.7 to execute the scripts. Everything else is not supported.
Install all needed Python modules
pip3 install -r requirements.txt
- First you have to make the script
run.sh
executable with
chmod +x run.sh
- Then you need to start the script file
./run.sh&
The recommended way to stop the bot is by using the bot command/shutdown
. If you don't want or can't use this, you can shut the bot down with:
pkill python3.7
which will killevery Python 3.7 process that is currently running.
/about - Show info about the bot/backup - Backup whole bot folder/feedback - Send us your feedback/help - Show all available commands/log - Download current logfile/restart - Restart the bot/shutdown - Shutdown the bot
/ceremony - Show ceremony intervals/epoch - Show info about current cycle/export - Export private key for identity/identity - Show details about a identity/import - Import private key for identity/kill - Kill your IDENA identity
/enode - Get enode info/offline - Go offline and stop mining/online - Go online and start mining/sync - Check if your node is synced/version - Show version number of node
/address - Show your DNA wallet address/balance - Show balance of your DNA wallet/deposit - Deposit DNA to your bot wallet/send - Send DNA from your bot wallet/stake - Show stake of your DNA wallet/transactions - Show your transactions
If you want to show a list of available commands as you type, open a chat with Telegram bot@BotFather and execute the command/setcommands
. Then choose the bot you want to activate the list for and after that send the list of commands with description. Something like this:
about - Show info about the botaddress - Show your DNA wallet addressbackup - Backup whole bot folderbalance - Show balance of your DNA walletceremony - Show ceremony intervalsdeposit - Deposit DNA to your bot walletenode - Get enode infoepoch - Show info about current cycleexport - Export private key for identityfeedback - Send us your feedbackhelp - Show all available commandsidentity - Show details about a identityimport - Import private key for identitykill - Kill your IDENA identitylog - Download current logfileoffline - Go offline and stop miningonline - Go online and start miningrestart - Restart the botsend - Send DNA from your bot walletshutdown - Shutdown the botstake - Show stake of your DNA walletsync - Check if your node is syncedtransactions - Show your transactionsversion - Show version number of node