# sousou15/bot architecture

> Architecture diagram of the GitHub repository sousou15/bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sousou15/bot
- Repository: https://github.com/sousou15/bot

## Overview

This is a Spanish-language Telegram bot that recommends movies based on a user’s mood. Telegram messages enter through polling and command handling; ordinary text is classified by a subprocess running the VADER-based sentiment script, then the bot queries TMDb and sends recommendations, including available trailers, back to the chat. The tree also contains alternative sentiment scripts and an update-clearing utility, but the shown runtime does not invoke them. Relationships below are based on the excerpts; no README documentation was provided.

Main entry points: [`bot.py`](https://github.com/sousou15/bot/blob/main/bot.py) (Command and message handling), [`sentiments3.py`](https://github.com/sousou15/bot/blob/main/sentiments3.py) (VADER mood classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_telegram["Telegram interaction"]
  node_polling["Update polling<br/>[bot.py]"]
  node_message_flow["Command and message handling<br/>[bot.py]"]
end

subgraph group_mood["Mood classification"]
  node_sentiment_runner["Sentiment subprocess<br/>[bot.py]"]
  node_mood_classifier["VADER mood classifier<br/>[sentiments3.py]"]
end

subgraph group_recommendations["Movie recommendations"]
  node_movie_discovery["TMDb movie discovery<br/>[bot.py]"]
  node_movie_details["Movie and trailer details<br/>[bot.py]"]
  node_recommendation_reply["Recommendation formatting and reply<br/>[bot.py]"]
end

node_user(("Telegram user"))
node_telegram_api{{"Telegram API"}}
node_translator{{"Google Translate"}}
node_tmdb{{"TMDb API"}}

node_user -->|"sends messages"| node_telegram_api
node_polling -->|"polls updates"| node_telegram_api
node_telegram_api -->|"returns updates"| node_polling
node_polling -->|"routes messages"| node_message_flow
node_message_flow -->|"sends replies"| node_telegram_api
node_message_flow -->|"runs subprocess"| node_sentiment_runner
node_sentiment_runner -->|"passes text"| node_mood_classifier
node_mood_classifier -->|"translates text"| node_translator
node_mood_classifier -->|"prints mood"| node_sentiment_runner
node_message_flow -->|"uses mood"| node_movie_discovery
node_movie_discovery -->|"requests movies"| node_tmdb
node_movie_discovery -->|"gets movie results"| node_movie_details
node_movie_details -->|"requests videos"| node_tmdb
node_movie_discovery -->|"formats results"| node_recommendation_reply
node_movie_details -->|"adds trailers"| node_recommendation_reply
node_recommendation_reply -->|"sends recommendations"| node_telegram_api
node_telegram_api -->|"delivers replies"| node_user

click node_polling "https://github.com/sousou15/bot/blob/main/bot.py"
click node_message_flow "https://github.com/sousou15/bot/blob/main/bot.py"
click node_sentiment_runner "https://github.com/sousou15/bot/blob/main/bot.py"
click node_mood_classifier "https://github.com/sousou15/bot/blob/main/sentiments3.py"
click node_movie_discovery "https://github.com/sousou15/bot/blob/main/bot.py"
click node_movie_details "https://github.com/sousou15/bot/blob/main/bot.py"
click node_recommendation_reply "https://github.com/sousou15/bot/blob/main/bot.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_polling,node_message_flow,node_user toneBlue
class node_sentiment_runner,node_mood_classifier toneAmber
class node_movie_discovery,node_movie_details,node_recommendation_reply,node_telegram_api,node_tmdb toneMint
class node_translator toneIndigo
```

## Components

### Telegram interaction

- [Update polling](https://github.com/sousou15/bot/blob/main/bot.py): `bot.py`
- [Command and message handling](https://github.com/sousou15/bot/blob/main/bot.py): `bot.py`

### Mood classification

- [Sentiment subprocess](https://github.com/sousou15/bot/blob/main/bot.py): `bot.py`
- [VADER mood classifier](https://github.com/sousou15/bot/blob/main/sentiments3.py): `sentiments3.py`

### Movie recommendations

- [TMDb movie discovery](https://github.com/sousou15/bot/blob/main/bot.py): `bot.py`
- [Movie and trailer details](https://github.com/sousou15/bot/blob/main/bot.py): `bot.py`
- [Recommendation formatting and reply](https://github.com/sousou15/bot/blob/main/bot.py): `bot.py`

### Other components

- **Telegram user**
- **Telegram API**
- **Google Translate**
- **TMDb API**

## Connections

- Telegram user → Telegram API: sends messages
- Update polling → Telegram API: polls updates (evidence: `bot.py`)
- Telegram API → Update polling: returns updates (evidence: `bot.py`)
- Update polling → Command and message handling: routes messages (evidence: `bot.py`)
- Command and message handling → Telegram API: sends replies (evidence: `bot.py`)
- Command and message handling → Sentiment subprocess: runs subprocess (evidence: `bot.py`)
- Sentiment subprocess → VADER mood classifier: passes text (evidence: `bot.py`)
- VADER mood classifier → Google Translate: translates text (evidence: `sentiments3.py`)
- VADER mood classifier → Sentiment subprocess: prints mood (evidence: `sentiments3.py`)
- Command and message handling → TMDb movie discovery: uses mood (evidence: `bot.py`)
- TMDb movie discovery → TMDb API: requests movies (evidence: `bot.py`)
- TMDb movie discovery → Movie and trailer details: gets movie results (evidence: `bot.py`)
- Movie and trailer details → TMDb API: requests videos (evidence: `bot.py`)
- TMDb movie discovery → Recommendation formatting and reply: formats results (evidence: `bot.py`)
- Movie and trailer details → Recommendation formatting and reply: adds trailers (evidence: `bot.py`)
- Recommendation formatting and reply → Telegram API: sends recommendations (evidence: `bot.py`)
- Telegram API → Telegram user: delivers replies
