Bots are small applications that run entirely within the Telegram app. Users interact with bots through flexible interfaces that can support any kind of task or service.
You can read more about bots in the official documentation:
Bots
Telegram Bot API
Demo bots from python-telegram-bot Examples
This bot shows phonetic, meaning, and pronunciations for entered words.
- Find this bot in Telegram by the name
@WordExplainBot
. - Enter the word you need the explanation in the chat with the bot.
This bot uses Free Dictionary API.
After getting a message from a user, the bot sends the request to Free Dictionary API
def get_meaning(word):
url = f'https://api.dictionaryapi.dev/api/v2/entries/en/{word}'
r = requests.get(url)
if r.status_code == 200:
data = r.json()
return format_respone(data)
else:
return f"Sorryy, I couldn't find the meaning of '{word}'."
Parse the result and send it back to the user.
You can host your bots on a third-party host
or your own
.
There are many choices for hosts. For example:
- Heroku
- PythonAnywhere
- AWS (Amazon Web Services)
- Google Cloud Platform
I'd recommend you start with PythonAnywhere
because of its simplicity and free plan.
I use Raspberry Pi 5 for hosting my bots.