Alternatively, follow the steps below to set it up on your local machine.
-
Clone the repository:
git clone https://github.com/hschickdevs/Telegram-Crypto-Alerts.git
-
CD into the repository root directory:
cd /Telegram-Crypto-Alerts
-
Install the required Python package dependencies:
pip install -r requirements.txt
-
Ensure that you have Python 3.9+ installed. If not, you can download here. The syntax is dependent on features added in this recent version.
-
If you haven't already, create a telegram bot using BotFather and get the bot token.
-
In the https://t.me/BotFather telegram chat:
- type /mybots
- -> @yourbot
- -> Edit Bot
- -> Edit Commands
- Paste and send the contents of
commands.txt
into the chat - From this point on, you will be using the new bot that you created for all commands. To access the new bot, click on the link that the BotFather sends you when generating the token where it says
@<YOUR_BOT_NAME_HERE>
.
-
Open a your command terminal and ensure that you are in the repository root directory
cd Telegram-Crypto-Alerts
-
Locate and set your environment variables:
The following environment variables are used by the bot:
-
TELEGRAM_USER_ID
: Your Telegram user ID (Use Raw Data Bot)Using this ID the bot will set you up as the initial administrator.
-
TELEGRAM_BOT_TOKEN
: Your Telegram bot token (Use BotFather) -
LOCATION
(Optional): EitherUS
orglobal
, determines which Binance market to use based on IP restrictions. -
TAAPIIO_APIKEY
(Optional): Your Taapi.io API key. If not provided, technical alerts will be unavailable. (Create an account on the Taapi.io website) -
TAAPIIO_TIER
(Optional): Your Taapi.io subscription tier. (Defaults tofree
if not provided)Options are
free
,basic
,pro
, andexpert
. Defaults tofree
if not provided. This is used to optimize rate limits.
See
.env.example
for an example of these environment variables.You can either create a
.env
file in the source directory and add the environment variables there, or you can set them in your system environment variables. -
-
(OPTIONAL) MongoDB Setup & Configuration
As of version 2, this bot supports MongoDB as a database backend to enable data persistence. If you'd like to use a MongoDB server to store your data, instead of the local JSON database default, follow the steps below:
First, set the
USE_MONGO_DB
config variable toTrue
in the static configuration file:/bot/config.py
Next, you will need to create a MongoDB Atlas account. You can sign up here.
Once you have created an account, you will need to create a new databse using the Altas UI: https://www.mongodb.com/basics/create-database#option-1
You will need to locate the following:
- Your
database connection string
- Your
database name
- Your
database collection name
All of the documents required for the program's backend are stored in the same collection. The documents are differentiated by the
user_id
field. Theuser_id
field is the telegram user id of the user that the document belongs to.You will then need to set the following environment variables or add them to your
.env
file:MONGODB_CONNECTION_STRING=<YOUR_URI> # The URI for your MongoDB server MONGODB_DATABASE=<YOUR_DB> # The name of the database to use MONGODB_COLLECTION=<YOUR_COLLECTION> # The name of the database collection to use
- Your
-
Run the
src
module using:# Windows: python -m src # or py -m src # Mac/Linux: python3 -m bot