https://github.com/dkoleev/telegram-bots
https://github.com/dkoleev/telegram-bots
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/dkoleev/telegram-bots
- Owner: dkoleev
- License: mit
- Created: 2024-09-10T06:10:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-24T07:06:12.000Z (over 1 year ago)
- Last Synced: 2025-01-22T14:24:23.897Z (over 1 year ago)
- Language: Python
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Telegram Bots on Python
## Table of Contents
- [What is a Telegram Bot](#what-is-telegram-bot)
- [Demo bots](#demo-bots)
- [My Bots](#my-bots)
- [Word Meaning Bot](#word-meaning-bot)
- [Host bots](#host-bots)
## What is a Telegram Bot
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](https://core.telegram.org/bots)
[Telegram Bot API](https://core.telegram.org/bots/api)
## [Demo Bots](https://github.com/dkoleev/telegram-bots/tree/main/demo)
Demo bots from python-telegram-bot [Examples](https://docs.python-telegram-bot.org/en/stable/examples.html)
## My Bots
## [Word Meaning Bot](https://github.com/dkoleev/telegram-bots/blob/main/word_meaning_bot.py)
This bot shows phonetic, meaning, and pronunciations for entered words.
### How to use:
1. Find this bot in Telegram by the name `@WordExplainBot`.
2. Enter the word you need the explanation in the chat with the bot.

### How it works:
This bot uses [Free Dictionary API](https://dictionaryapi.dev/).
After getting a message from a user, the bot sends the request to `Free Dictionary API`
```python3
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.
## Host bots
You can host your bots on a `third-party host` or `your own`.
### Third-party hosts
There are many choices for hosts. For example:
* Heroku
* [PythonAnywhere](https://www.pythonanywhere.com/)
* AWS (Amazon Web Services)
* Google Cloud Platform
I'd recommend you start with `PythonAnywhere` because of its simplicity and free plan.
### Own host
I use [Raspberry Pi 5](https://www.raspberrypi.com/products/raspberry-pi-5/) for hosting my bots.