WARNER-ME Telegram Bot

Berkedilekoglu
DevOps.dev
Published in
4 min readDec 26, 2022

--

Working Scheme of Warner-Me

Hey, fellow developers! We all know the frustration of compiling code that takes a long time to run. Sometimes we have to sit at our computers and wait for the results, or constantly check to see if the code has finished running. With Warner-Me, you can now receive notifications on Telegram as soon as your code has finished running! No more waiting or constantly checking. Just sit back and let Warner-Me handle the updates for you.

Once you have registered with Warner-Me, the REST API will allow you to receive notifications at any time when your code has finished running. You can use Warner-Me to track the status and results of your code and receive updates as soon as they are available. Simply make an HTTP request to the API with your unique ID and the desired parameters, and Warner-Me will handle the rest.

REGISTRATION

1 ) Finding Bot in Telegram

To use Warner-Me, you’ll first need to register with the Telegram bot. You can do this by searching for ‘WARNMEE_BOT’ in the search bar of your Telegram app, or by using the QR code above. Once you’ve registered, you’ll be able to start receiving notifications from Warner-Me whenever your code finishes running.

QR Code

2) Available Commands

  • /help command will provide you with information on how to use the bot and other necessary commands. Simply type ‘/help’ in the chat with the bot to see a list of available commands and their descriptions.
  • /id command will provide you with your unique ID. This ID will allow you to use the Warner-Me Rest API to track your code. Simply type ‘/id’ in the chat with the bot to receive your ID.
  • /register command will register you in the Warner-Me database. If you’re using Warner-Me for the first time, you’ll need to register before you can start receiving notifications. Simply type ‘/register’ in the chat with the bot to complete the registration process.
  • /status command will manually show you the status and results of your code. By default, the status of your code is ‘inactive’ and the results are an empty string ‘’. Simply type ‘/status’ in the chat with the bot to see the current status and results of your code.

USAGE OF Warner-Me Api

Warner-Me is a RESTful API and is very easy to use. The only package you need to make requests is the ‘requests’ package. Here’s an example of how you can use the Warner-Me API in Python using the requests package:

import requests

BASE = "https://warnerme-bot-api.onrender.com/" #Adress of our API

response = requests.get(BASE + "warnMe/your_id", {}) # You can get current information. your_id is id that was taken by Warner-Me Telegram Bot.
print(response.json()) # You can print the current information

requests.patch(BASE + "warnMe/your_id", {'codeStatus':'active', 'results':''}) #patch updates your code status and results. Before running a code script you can change it as active.
"""
YOUR CODE HERE:

For instance model.fit() or any other script.
"""
requests.post(BASE + "warnMe/your_id", {'codeStatus':'inactive', 'results':'acc:0.9, f1:0.6'}) #post also updates your code states and results. The only difference between patch and post is that post will inform you on Telegram automatically when your process is done.

As you can see in the example, you can use the .get() function to retrieve information from the database using your unique ID.

You can use the .patch() function to update the codeStatus and results information. If you have recently finished an operation, you can reset the codeStatus to 'inactive' and the results to an empty string to return to the default settings.

The .post() and .patch() functions both allow you to update the codeStatus and results of your code. The main difference between the two is that .post() will automatically send you a message on Telegram with your updated codeStatus and results, while .patch() will not send a message.

PS: General Usage

requests.post(BASE + "warnMe/your_id", {'codeStatus':'SOME STRING HERE', 'results':'SOME STRING HERE'}) #You can write what ever you want for your codeStatus and results.

Actually, Warner-Me was designed to provide you with two pieces of information: the codeStatus and the results. As shown in the example, you can fill in these fields with any information you like.

Pros and Cons

Warner-Me was created to make your life easier and allow you to step away from your desk while your code is running. It’s completely free to use and can be a helpful tool for anyone who needs to track the status and results of their code.

Although Warner-Me is completely free to use, it is hosted on render.com and may take up to 30 seconds to respond if the system has been inactive for 30 minutes. If you are experiencing delays in getting a response, you should wait 30 seconds.

I hope you find Warner-Me helpful and useful in your work! If you have any questions or need further assistance, please don’t hesitate to ask. You can also refer to the API documentation for more information on how to use Warner-Me on MyGithub. If you like Warner-Me and find it useful, please don’t forget to leave a star to repo!

You can find me on Twitter and LinkedIn if you’d like to connect and stay updated on my work. I’m always happy to connect with other developers and professionals in the tech community.

--

--

NLP Research Engineer, Teaching Assistant, Research Assistant in Bioinformatics