[Nulled] » Nulled Warez Scripts » Telegram » The script of the Telegram bot of the TRX exchanger
November 15 2023

The script of the Telegram bot of the TRX exchanger

timecv 15-11-2023, 05:47 Telegram»,Telegram Bot 272

The bot has 3 ready-made payment systems (CRYSTAL PAY (crypta), CRYPTOBOT (P2P crypta), PAYOK (cards, e-wallets, SIM cards, crypta)), the addition of new ones is negotiated separately.

The script of the Telegram bot of the TRX exchanger

The script of the Telegram bot of the TRX exchanger


User functionality
 

Buying TRX
TRX Calculator


Administrator functionality
 

Access to the admin panel
Transaction confirmation
Cancellation of the transaction


Admin panel functionality
 

2 types of mailings
Changing the balance
Course change
Downloading the database
Downloading logs
Change min. and max. transaction amounts
Addendum/Deleting an Administrator
Statistics
The final script of the Telegram bot that provides the TRX exchange service could look like this:

import telegram
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
import requests
from decimal import Decimal


def start(update, context):
"""Handler for the /start."""
update.message.reply_text('Hi! I am a bot of the TRX exchanger. Type /help to get a list of available commands.')


def help(update, context):
"""Handler for the /help."""
update.message.reply_text('/exchange - start the TRX exchange process.')


def exchange(update, context):
"""Handler for the /exchange command."""
update.message.reply_text('Enter the amount of TRX you want to exchange.')


def trx_to_usd(trx_value):
"""Convert TRX to USD using the CoinMarketCap API."""
response = requests.get('https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest ',
headers={'X-CMC_PRO_API_KEY': 'YOUR_API_KEY'},
params={'symbol': 'TRX'})
response_data = response.json()
trx_price_usd = response_data['data']['TRX']['quote']['USD']['price']
return trx_value * trx_price_usd


def handle_inline_callback(update, context):
"""Handler for inline currency selection buttons."""
query = update.callback_query
data = query.data
amount_trx = Decimal(data.split('_')[0])
target_currency = data.split('_')[1]
if target_currency == 'USD':
result = trx_to_usd(amount_trx)
query.answer(text=f'{amount_trx} TRX = ${result:.2f}')
else:
query.answer(text=f'The exchange of {amount_trx} TRX in {target_currency} is currently unavailable.')


def check_input(update, context):
"""Checking user input and creating inline buttons for currency selection."""
trx_amount = Decimal(update.message.text)
usd_amount = trx_to_usd(trx_amount)
message =f'{trx_amount} TRX equals {usd_amount:.2f} USD. Choose which currency you want to exchange your TRX into.'
keyboard = [[InlineKeyboardButton("USD", callback_data=f'{trx_amount}_USD')],
[InlineKeyboardButton("EUR", callback_data=f'{trx_amount}_EUR')],
[InlineKeyboardButton("RUB", callback_data=f'{trx_amount}_RUB')],
[InlineKeyboardButton("BTC", callback_data=f'{trx_amount}_BTC')],
[InlineKeyboardButton("ETH", callback_data=f'{trx_amount}_ETH')]]
reply_markup = InlineKeyboardMarkup(keyboard)
update.message.reply_text(message, reply_markup=reply_markup)


def main():
"""Initializing the bot and launching."""
# Initializing the bot with a token.
updater = Updater(token='YOUR_TOKEN', use_context=True)

# Initializing the dispatcher.
dispatcher = updater.dispatcher

# Team handlers.
dispatcher.add_handler(CommandHandler('start', start))
dispatcher.add_handler(CommandHandler('help', help))
dispatcher.add_handler(CommandHandler('exchange', exchange))

# User input handlers.
dispatcher.add_handler(CallbackQueryHandler(handle_inline_callback))
dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, check_input))

# Launch the bot.
updater.start_polling()
updater.idle()


if __name__ == '__main__':
main()
This script is responsible for the operation of the TRX exchanger bot. When receiving the /start command, the bot greets the user and informs about the available commands. When receiving the /exchange command, the bot requests the number of TRX to exchange. After receiving the user input, the bot checks it and provides the user with inline buttons to select the exchange currency. When the user selects a currency, the bot converts the amount of TRX into the selected currency and sends the result to the user. To convert TRX to USD, the CoinMarketCap API is used. However, you must register your API key and use it in the code replacing YOUR_API_KEY. Also, you must register the bot in Telegram and replace YOUR_TOKEN in the corresponding line of code.


Information

Visitors who are in the group Guests they can't download files.
Log in to the site under your login and password or if you are a new user go through the process registrations on the website.

Comments:

This publication has no comments yet. You can be the first!

Information the publication:

  • Author of the publication: timecv
  • Date of publication: 15 November 2023 05:47
  • Publication category(s): Telegram»,Telegram Bot
  • Number of views of the publication: 272
  • Number of comments to the publication: 0

Related News

15 November 2023
Telegram»,Telegram Bot
Telegram bot file

Telegram bot file sharing service

Read more
15 November 2023
Telegram»,Telegram Bot
Telegram Bot Anonymous

Telegram Bot Anonymous Chat

Read more
15 November 2023
Telegram»,Telegram Bot
Telegram bot ChatGPT

Telegram bot ChatGPT

Read more
24 November 2022
WordPress»,WordPress Plugins
WP All Import Pro 4.7.5

WP All Import Pro is a WordPress plugin developed by Soflyy (WP All Import). WP All Import Pro allows you to

Read more
15 November 2023
Telegram»,Telegram Bot
Telegram Bot in Python,

A Python bot, a store with a catalog and auto-sale of goods, replenishment methods: cards, USDT, TRX, LTC, BTC.

Read more

Information

Users of 🆅🅸🆂🅸🆃🅾🆁 are not allowed to comment this publication.

Site Search

Site Menu


☑ Websites Scripts

Calendar

«    December 2024    »
MonTueWedThuFriSatSun
 1
2345678
9101112131415
16171819202122
23242526272829
3031 

Advertisement

Survey on the website

Evaluate the work of the site
 

Statistics

  • +4 Total articles 6750
  • +14 Comments 4226
  • +31 Users : 6040