Closed BraveCanister closed 5 days ago
Hi,
pm2 delete tg-bot
If you only want to see updates that are pushed by the script, but not control the sessions or request logs files etc., then you can enter the same API key into all instances of the script, but don't set up the tg-bot
pm2 process as it will cause conflicts (or a maximum of one instance with the tg-bot
process).
However, if you wish to have multiple machines all running the script, and to maintain all the benefits of being able to control each instance, you'll need to create a separate Telegram bot on each, with a unique API token from BotFather. This is necessary because each bot needs a unique identity to function independently, preventing conflicts between instances. As you're self-hosting the script, there's no central server managing the status or overseeing the management of sessions across multiple environments. Instead, everything is handled on an instance-by-instance basis, which requires separate bots.
The bot on each machine isn't just relaying information about the status of your claims; it's also listening for commands that let you manipulate the sessions within PM2. Using the same bot for multiple environments can lead to conflicts, especially when commands target a session that exists on one machine but not on the other. For example, a command to restart a session could mistakenly be executed on the wrong instance, leading to numerous errors and an unreliable experience.
In your setup—where multiple environments (PC and VPS) operate independently—each environment should have its own bot. This means each bot needs a unique API token. Doing so ensures each instance manages notifications, handles updates consistently, and avoids conflicts.
/logs <session name> <lines>
to retrieve recent logs, which helps in diagnosing issues./status
command helps you check the current state of all sessions or a specific one./list
, /start
, /restart
, and /stop
allow you to control the PM2 game sessions easily, based on patterns or session names./update
to ensure the latest versions are running, using automated pull scripts.You can easily create a new bot by registering via @BotFather for your VPS instance. This will provide you with a new API token, allowing both bots to handle notifications and commands without interfering with one another.
While the idea of setting up separate bots might initially feel counterintuitive, it is ultimately about avoiding connectivity issues when trying to connect multiple bots to a single Telegram API key and maintaining clear boundaries between instances. This setup prevents confusion and keeps both your notification systems and command-handling processes stable for each environment. Setting up a new bot is straightforward, and the benefits of reliability and consistency make it well worth the effort.
I have a telegram bot set up for notifications on my PC and it works fine. However when I set up the claimer on VPS and provided the same API token, it doesn't seem to work. Do I have to set up a separate telegram bot with its unique API token to receive notifications from that other instance? Seems a bit counterintuitive to me.