-
The user sends the /start command to the bot (or starts it by searching for it):
- Бот проверяет, подписан ли пользователь на телеграм-канал по ID канала (ID канала можно изменить в файле .env в переменной CHAT_ID):
-
At this stage the user can perform 5 actions:
- Send a chat command /help or /help.
- Send the command /reset to chat
- Send a photo to the chat room
- Send a text message to the chat
- Send any other message to the chat (video, audio, document, file...)
-
The user sends a chat command /help or /start:
-
The user sends a chat command /reset:
-
The user send a photo to the chat room:
-
The user send a text message to the chat:
-
The user send any other message to the chat (video, audio, document, file...):
- bot_gpt - root directory of the entire project
- bot.py - The main executable file - the entry point to the bot
- .env.example - A file with sample secrets for GitHub
- .gitignore - file that tells the git which files and directories not to track
- README.md - File with instructions on how to use the bot
- requirements.txt - File with libraries required for the bot to work
- config.py - file with environment variables (secret data) for bot configuration
- BOT_TOKEN - Replace with your own token from BotFather
- API_KEY - Replace the gpt3.5 turbo api key from the openai website with your own
- CHAT_ID - Enter the chat ID that users must subscribe to before sending messages to the bot, the chat ID can be found in the bot https://t.me/username_to_id_bot by sending a link to your chat
- TWS - Text animation writing speed, 0.1 high speed 0.9 slow
- other_handlers.py - module with a handler for any user messages that are not caught by other handlers
- user_handlers.py - module with user handlers. All basic bot update handlers will be in this module
- lexicon.py - file with a dictionary of commands and requests that correspond to the displayed texts. That is, for example, if the user sent the command /start - he should get back some text. This text may change over time or depending on the user's language. It is convenient to store such correspondences in a separate file.
- photo - This directory stores photos that the user sends to Telegram. And the photo is automatically deleted from here
- photo_for_md - photo for README.md file
- utils - directory with auxiliary tools for bot operation