Support Telegram Bot For Github Project

Here we will build a support telegram bot which will search users question keywords in your Readme.md and will send a link to the most relevant part of your md to the user.

We will use an open source project “draw your bot” (https://github.com/Tsitko/drawyourbot) to generate a bot. It allows to draw a bot structure in draw.io instead of coding it.

So we need to clone drawyourbot project and install its requirements (the instructions of how to install requirements are here: https://github.com/Tsitko/drawyourbot#install-requirements).

And we also need to register our bot in telegram (the instruction is here: https://core.telegram.org/bots#6-botfather)

To search in Readme.md we will use a function from draw your bot standardfucs (https://github.com/Tsitko/drawyourbot#search_md). But you can use your own function (just code that function, add and add a .py file with that function to ‘bots’ folder).

And as we have a draw your bot project and a function to search in md file, we only need to draw our bot structure in draw.io:

drawio source: https://github.com/Tsitko/drawyourbot/blob/main/examples/support_md.drawio

You need to change bot_token to your bots token and if you are using your own function, you need to change _functions_standardfuncs::search_md(query, “https://github.com/Tsitko/drawyourbot/blob/main/README.md”) to your own function.

If you are ok to use the standard search_md function, you just need to change https://github.com/Tsitko/drawyourbot/blob/main/README.md to the link to your projects md.

So the bot will just ask the user what he/she is looking for and will get the user’s answer. After that it will find a link to the part of your Readme.md which is the most relevant to the user (if it will not find such a part it will return a link to Readme.md start line). And in the end it will ask the user to push /start command if he wants to search again. The /start command is to start from the first message (what are you looking for?).

Trending Bot Articles:

1. Chatbot Trends Report 2021

2. 4 DO’s and 3 DON’Ts for Training a Chatbot NLP Model

3. Concierge Bot: Handle Multiple Chatbots from One Chat Screen

4. An expert system: Conversational AI Vs Chatbots

And as you are done, you need just to generate a bot (instructions: https://github.com/Tsitko/drawyourbot#generating-bot-code).

And you have a bot which you can run and test:

Don’t forget to give us your 👏 !


Support Telegram Bot For Github Project was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.