A Telegram bot that fetches the price of a Telegram Gift (NFT) from multiple markets and displays them in different currencies.
- Fetches gift prices from three markets: Tonnel, Portals, and MRKT.
- Displays prices in TON, USD, and IRR.
- Easy to use with simple commands.
- Can be added to groups.
-
Clone the repository:
git clone https://github.com/thegbu/Gift-Price gift-price/ && cd gift-price
-
Create a virtual environment:
-
Windows:
python -m venv venv venv\Scripts\activate
To deactivate the virtual environment later, simply run
deactivate. -
Linux:
python3 -m venv venv source venv/bin/activateTo deactivate the virtual environment later, simply run
deactivate.
-
-
Install the dependencies:
pip install -r requirements.txt
-
Open
.envfile and edit itBOT_TOKEN: Your Telegram bot token from @BotFather.API_IDandAPI_HASH: Your Telegram API credentials from my.telegram.org.CHANNEL_NAMEandCHANNEL_URLare optional. If you provide them, the bot will display a button with your channel's name and link.TONNEL_URL,PORTALS_URL,MRKT_URL: These are optional referral links for the markets. If provided, the market names in the bot's response will link to these URLs. If omitted, the names will be displayed as plain text.
-
Generate the Pyrogram sessions:
Run the following command to generate the
portals.sessionandmrkt.sessionfiles:python3 generate_sessions.py
To use MRKT and Portals, you need to log in with a Telegram account that has already started both bots. Therefore, after running
generate_sessions.py, you will be required to log in to the same account twice.
-
Run the bot:
python3 main.py
-
Use the commands:
/startor/help: Displays a welcome message./por/price: Fetches the price of a gift.
You can use the
/por/pricecommand in two ways:- Send the command with a link:
/p https://t.me/nft/... - Reply to a message that contains a link with just the command:
/p
To keep the bot running 24/7 on a server, you should run it inside a terminal multiplexer like tmux or screen. This will prevent the bot from stopping when you close your SSH session.
- Start a new
tmuxsession:tmux new -s gift-bot
- Run the bot:
python3 main.py
- Detach from the session by pressing
Ctrl+bthend. The bot will continue running. - To re-attach to the session later, use:
tmux attach -t gift-bot
- Start a new
screensession:screen -S gift-bot
- Run the bot:
python3 main.py
- Detach from the session by pressing
Ctrl+athend. - To re-attach to the session later, use:
screen -r gift-bot