Skip to content

Commit

Permalink
Read.me, requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriiMotov committed Sep 22, 2023
1 parent 0e310b5 commit e39eebd
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 3 deletions.
64 changes: 63 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,64 @@
# AdBot
Telegram bot that can forward to you messages from different groups by your keywords
Telegram bot that can forward you messages from different groups based on your keywords.

This is a study project I develop to practice using different libraries.
But it can also be useful.


## Libraries used
- aiogram-dialog 2.0.0
- aiogram 3.0.0
- telethon
- SQLAlchemy
- APScheduler


## How it works
There are two parts that work in parallel:
- telegram client (based on the `telethon` library), that fetches messages from configured group chats and channels and store them into DB.
- telegram bot (aiogram-dialog), that manages user's settings (keywordsm subcription state) and forwards messages to users.

User starts conversation with the bot by using '/start' command. It shows menu as shown below:

![](/resources/menu.png "Menu")

By clicking the 'Manage keywords' menu button, keywords menagement menu section will be shown.

![](/resources/keywords-manage.png "Keywords management")

Here it`s possible to add keywords. Just write keyword and press send button.

![](/resources/add-keyword.png "Add keyword")

or remove some keywords (click 'remove keywords' and choose keywords to remove (one of the buttons with keyword text and red cross)).

![](/resources/remove-keyword.png "Remove keyword")

After configuring the keywords, user can go back to the top level menu and enable subscription by clicking the 'Enable subscription' button. The subcription status will be changed to 'Subscription state: '✅ enabled'.

![](/resources/subscription-enabled.png "Subscription enabled")

After that bot will filter all new messages in followed chats and forward to user.

But forwarding is suspended while menu is open. There is a warning message in the bottom part of the menu, that also shows the number of messages in the forwarding queue.

![](/resources/forwarding-queue.png "Forwarding queue")

To recieve these messages you need to close the menu. Or it will be automatically closed after 2 minutes of user inactivity.

![](/resources/menu-closed.png "Menu closed")

Now messages will be forwarded to user.

![](/resources/message-received.png "Message received")



## Future plans
- switch to async DB
- add more e2e tests
- add multilanguage support
- divide all chats into categories and let the user choose which ones he wants to subscribe to
- admin notification on critical errors
- create FastAPI and Flask interfaces (just to practice using thos libraries)
- create other types of message fetchers (from Facebook groups and other web-sources)
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
aiofiles==23.1.0
aiogram==3.0.0b9
aiogram-dialog==2.0.0b21
aiogram==3.0.0
aiogram-dialog==2.0.0
aiohttp==3.8.5
aiosignal==1.3.1
annotated-types==0.5.0
Expand Down
Binary file added resources/add-keyword.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/forwarding-queue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/keywords-manage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/menu-closed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/message-received.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/remove-keyword.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/subscription-enabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e39eebd

Please sign in to comment.