You can make your own effective assistant for work from your simple Telegram bot. First, you should teach your bot how to analyze information about technological or emergency events and how inform the user about it. As an example, i will show you, how bot copes with this task within the company in which I work. All in all bot Boris monitors the data network.
Let’s get a closer look.
The data network equipment sends messages to the log server where the messages are added to the log file. A simple program analyzes this log file and searches it for messages about emergency events, such as high CPU load, link Down, Broadcast storm, etc. If such an event is found, information is instantly sent by Boris to a special telegram group where direct executors and managers are missing extra information processing units that would introduce a temporary delay and distort the information (see Alex’s article on multistage management). In addition to information about an emergency event, the bot can provide additional information necessary to correct the situation, for example, an employee’s phone. The message sent to the group of performers and managers in the first place does not make it possible to ignore the event to individual group members, in the second it makes it possible to immediately get advice from more experienced group members.
A script for sending messages on behalf of a bot to a user, a group of users, or to a telegram channel. Chat groups or channels have a minus sign in front of the number. It should also be borne in mind that a bot can send messages only to “familiar” people, that is, people with whom the bot has already communicated.
token = <"Your Telegram IPI key"> #string
bot = telegram.Bot(token=token)
chat_id = <chat ID user, group ID or channell ID> #integer
text= """Inside every program there is an algorithm trying to get out"""# text for example
except Exception as err:
An example of the work of Boris’s bot. Unfortunately, the messages are in Russian, but I think the general idea is clear. If you need more information you can ask in the comments.