Hello!
There is a bot written in PHP that sends data to the bot as it arrives.
A new bot needs to be created in any language, the main thing is quality.
An example of such a bot is - @inflow_chatbot
It needs to accept payments, the service will be similar to wayforpay, this will be the service - https://fondy.ua/
A referral system is not needed.
Then combine the two bots into one. There will be an API in PHP for data retrieval.
Here is what ChatGPT recommends for merging bots.
Yes, it is possible to combine the old PHP bot with the new bot written in Python in several ways:
1. Using a common Webhook
The Python bot can be set up to receive all incoming requests from Telegram and then forward or process them together with the PHP bot.
How to implement this:
• The new Python bot processes the Webhook, but instead of fully processing all messages, it can pass certain commands to the PHP bot.
• The Python bot can act as a proxy, forwarding data to the PHP bot and back.
2. Using API between bots
The PHP bot can continue to operate as an API server, while the Python bot will call it when needed.
How to implement this:
• The PHP bot provides an API (for example, via REST API), which the Python bot calls to process commands or retrieve necessary data.
• The Python bot is responsible for the visual design but interacts with the PHP bot through HTTP requests.
3. Using one token for both bots (separating logic)
Telegram allows using one token for multiple bots, but it is important that they correctly separate tasks.
How to implement this:
• One bot (Python) acts as the main one and filters commands, while the PHP bot processes only certain requests.
• It is possible to have the Python bot pass necessary commands to the PHP bot via cURL or requests.
4. Using WebSockets or Redis for data exchange
• The Python bot can send commands to the PHP bot via Redis Pub/Sub or WebSockets.
• The PHP bot remains operational, but its logic is invoked through Python.
Which method is better?
• If you need to completely replace the PHP bot: It is better to rewrite it in Python and just retain the logic.
• If you want the PHP bot to continue working in parallel: You can use API calls or a common Webhook.
• If you want to migrate gradually: The Python bot can first take over the visual aspect and then gradually adopt the functionality.
Depending on the desired outcome, one of the methods can be chosen or they can be combined.