I have a Telegram account and created Telegram bot to do some actions on remote machines.
It works ok.
I fixed some codes in the bot and want to update all bots on all computers?
I.e. the bot understands command "/update" but how to pass the new .exe from my computer to all bots and do self-update?
I have also written such a bot with a self-update mechanism.
To Update the bot I just have to send the new .exe over Telegram, but any other method works fine.
Basically, I do the following:
getFilewith the file_id to get the path.
On windows, you can't change a .exe while it is running.
I run my bot as windows service, which makes things a bit more complicated, but also easier:
If the bot runs as SYSTEM user, permissions/UAC are not a problem. Otherwise allow the service user to write the executable and start the process.
If you run the program from desktop, then UAC can be a problem: If run as admin, you are fine. Processes started inherit the admin access. If not run as admin... Well the user your bot runs on requires write access to the executable.