Python/Perl/Bash (Python) QIWI TELEGRAM BOT

K4NITEL

Administrator
Staff member
Admin
Joined
Jun 18, 2022
Messages
43
Hellcoins
♆516
Telegram Qiwi Bot The application was created for ordinary users of Telegram and Qiwi Using this product, you can perform banking operations, view the status of payments, search for the nearest replenishment points, in general, a pocket qiwi wallet in a telegram
For those who are too lazy to install, I can give the telegram address of my bot already installed and an improved version for use, this version is open source for studying or something else)
Introduction (APIs used) are

Conversion description

Structure :


✏️Application divided into 3 ✏️ : files
1) Bot.py - the main logic of the bot
2) QIWI_API.py - work with the API
3) Languages.json - test buttons and dialogs

Features :
The application uses 6 types of API Geocoder and Static API from Yandex work in conjunction with QIWI-Terminal-Map API and FreeGEOIP to display terminal maps or their addresses to the user. The user also has the option to send their location.
(modules)

✏️ urllib - sending GET requests
✏️ json - help with sending POST requests and working with localization
✏️ time - help with sending POST requests (UNIX TIME)
✏️ requests - sending POST requests
✏️ os - clearing working folder after sending
✏️ telegram receipt image (Python-Telegram- Bot) - interaction with Telegram servers
(error classes)
💡 QiwiError(Exception)💡
➡️ SyntaxisError(QiwiError) "Query execution failed"

➡️ TokenError(QiwiError) "Wrong TOKEN"

➡️ class NoRightsError(QiwiError): "No right"

➡️ TransactionNotFound(QiwiError) "Transaction not found or missing payments with specified characteristics"

➡️ WalletError(QiwiError) "Wallet not found"

➡️ HistoryError(QiwiError) "Too many requests, the service is temporarily unavailable"

➡️ MapError(QiwiError) "Map processing errors"

➡️ NotFoundAddress(MapError) "Could not find address"

➡️ CheckError(QiwiError) "Could not get check"

➡️ WrongEmail(CheckError) "Wrong Email address"

➡️ WrongNumber(QiwiError) "Wrong phone number"

➡️ TransactionError(QiwiError) "Failed to carry out the transaction"
💡 class UserQiwi💡

UserQiwi.url = https://edge.qiwi.com/

➡️ self.token(str) = user token
➡️ self.headers(dict) = headers for making requests
➡️ self.urls(dict) = forms for filling in links for requests
➡️ self.currency(dict) = "currency converter"
➡️ self.identification(dict) = "id converter"
➡️ self.user_date(dict) = user info

💡 class UserQiwi 💡

:) Data is presented as :
(Name | Variables | Description | Return Type) :)

➡️ (__init__self | token | declares a new user | None)
➡️ (change_tokenself | new_token | changes user token | None)
➡️ (get_user_token | self | returns user token | str)
➡️ (get_balance | self | returns user account balance | str)
➡️ (update_info | self | updates self.user_data | None)
➡️ (get_info | self | returns user information | str)

💡 class UserQiwi:bulb:

:) Data is presented as: (Name | Variables | Description | Return data type) :smile24 :

➡️ (get_last_transactionsself | rows
(default = 10) | Returns the user's last transactions | str)
➡️ (get_info_about_transaction | self | transaction_id | Returns transaction information | str)
➡️ (get_map_terminates | self, address
(default None) | Returns a link to the map image and terminal addresses | dict)
➡️ (get_image_checkself | transaction_id, file_name (default "check.jpg") | Generates a check image of the specified transaction (does not work with IN transaction type) | None)
➡️ (send_check_emailself | transaction_id, email
(default None) | Sends image of a check to the mail If the mail is not specified, the user's mail is used | None)

💡 class UserQiwi:bulb:

:) Data is presented as :
(Name | Variables | Description | Return type) :)

➡️ (transaction_telephoneself | amount, number
(default None) | Transfers funds from the owner's account to the specified number. If there is none, the user's number is used | None)
➡️ transaction_qiwiself | account_id, amount | Transfers funds from the owner's account to the specified account | none)

:) Functions QIWI_API : :)
:
➡️ run_the_query(headers, url) - Runs a GET request (urllib + json) | dict/bool
➡️ found_address(ip) - Performs a GET request (requests). Returns the city specified by ip address
➡️ str/bool write_file(headers, url, file_name) - Performs
a GET request (urllib). Writes a receipt image to the specified file. | bool found_id(number) - Performs a POST request
(requests). Returns the id of the mobile operator. | str/bool

:) Bot.py :)

:) Data is presented as :
(Name | Variables | Description) :)

➡️ (startbot | update | Getting started with the bot)
➡️ (check_tokenbot| update, user_data | Checking the token)
➡️ (balancebot | update, user_data | Sends the balance)
➡️ (transactionsbot | updateStart | dialogue about transactions. )
➡️ (check_statusbot | update | Please enter transaction id)
➡️ (answer_about_transactionbot | update, user_data | Sends transaction information)
➡️ (lastbot | update, user_data | Sends information about last transactions)

:) Bot.py :)

:) Data is presented as :
(Name | Variables | Description) :)

➡️ (terminalsbot | update, user_data | Getting started with transactions)
➡️ (take_command_found_addressbot | update, user_data | Response type selection)
➡️ (take_addressbot | update | Please enter an address)
➡️ (take_locationbot | update, user_data | Processing geolocation coordinates of the user)
➡️ (answer_about_terminatesbot | update | Sending a response)
➡️ (optionsbot | update | Starting a dialog about settings)
➡️ (get_infobot | update, user_data | Sends information about the user)

:) Bot.py :)

:) Data is presented as :
(Name | Variables | Description) :)

➡️ (take_new_tokenbot | update | Change user)
➡️ (update_userbot | update, user_data | Update account information)
➡️ (versionbot | update | Send program version)
➡️ (checkbot | update, user_data | Start dialog about checks)
➡️ (dialog_emailbot | update, user_data | Start email dialog)
➡️ (enter_emailbot | update | Please enter email)
➡️ (get_emailbot | update, user_data | Get email. Please enter transaction id)

:) Bot.py :)

:) Data is presented as :
(Name | Variables | Description) :)

➡️ (enter_transaction_idbot | update | Please enter the transaction id.)
➡️ (get_transaction_idbot | update, user_data | Display/e-mail a copy of the check)
➡️ (paybot | update, user_data | Start the payment dialog)
➡️ (enter_user_idbot | update, user_data | Please enter client id)
➡️ (get_user_idbot | update, user_data | Get client id. Please enter transfer amount.)
➡️ (mobile_phonebot | update, user_data | Start dialog about choosing mobile phone number)
➡️ (enter_mobilebot | update | Please enter mobile number)

:) Bot.py :)

:) Data is presented as :
(Name | Variables | Description): smile24:

➡️ (get_mobilebot | update, user_data | Get mobile phone number. Please enter payment amount.)
➡️ (enter_amountbot | update | Please enter payment amount.)
➡️ (get_amountbot | update, user_data |
Mobile payment/transfer
Qiwi client)
➡️ (wrong_answerbot | update | Send instructions to use the keyboard)
➡️ (backbot | update | Return to the start menu.)
➡️ (stopbot | update | Shut down the bot)


Source Code

QIWI_API.py
You must reply before you can see the hidden data contained here.
Bot.py

You must reply before you can see the hidden data contained here.
Languages.json

You must reply before you can see the hidden data contained here.
 
Last edited by a moderator:
Top