How akiratorizawa/afg-bot works
AFG is a Discord bot and Flask-based football statistics site. The main Discord workflow accepts a game-stat JSON attachment, updates season totals, builds a game report, and records per-game statistics; separate commands view or transfer player stats and announce streams. Flask reads the season and game-log databases to serve leaderboards and player profiles. The graph preserves the major sampled bot and web capabilities; database and template relationships are shown where excerpts establish them. Other service internals were not sampled, so their detailed behavior is not inferred.
Main entry points: bot.py Command handlers · app.py Flask routes and queries · s24_d1.db Division 1 season data · stats.py Season stat updates
Components 18
Discord bot
- Command handlers
bot.py - Bot initialization
utility/initialization.py - Player autocomplete
utility/get_players.py
Game processing
- Season stat updates
services/stats.py - Game report
services/game_report.py - Game log
services/log_game.py - Stream announcement
services/stream.py
Player statistics
- Player stat view
services/view_stats.py - Stat transfer
services/transfer_stats.py - Domain errors
services/errors.py
Stats website
- Flask routes and queries
app/app.py - Leaderboard and profile views
app/templates
SQLite storage
- Division 1 season data
app/databases/s24_d1.db - Division 2 season data
app/databases/s24_d2.db - Division 1 game logs
app/databases/s24_d1_logs.db - Division 2 game logs
app/databases/s24_d2_logs.db
Other components
- Discord user
- Roblox user and avatar APIs
Connections 24
- Discord user → Command handlers: invokes commands
bot.py - Command handlers → Bot initialization: initializes
bot.py - Command handlers → Player autocomplete: gets suggestions
bot.py - Command handlers → Season stat updates: records stats
bot.py - Command handlers → Game report: builds report
bot.py - Command handlers → Game log: logs game
bot.py - Command handlers → Stream announcement: creates announcement
bot.py - Command handlers → Player stat view: requests stats
bot.py - Command handlers → Stat transfer: transfers stats
bot.py - Season stat updates → Division 1 season data: updates totals
services/stats.py - Season stat updates → Division 2 season data: updates totals
services/stats.py - Game log → Division 1 game logs: writes game rows
services/log_game.py - Game log → Division 2 game logs: writes game rows
services/log_game.py - Stat transfer → Division 1 season data: reads and updates
services/transfer_stats.py - Stat transfer → Division 2 season data: reads and updates
services/transfer_stats.py - Player stat view → Division 1 season data: reads player stats
services/view_stats.py - Player stat view → Roblox user and avatar APIs: gets avatar
services/view_stats.py - Game report → Roblox user and avatar APIs: gets avatars
services/game_report.py - Player autocomplete → Division 1 season data: queries players
utility/get_players.py - Flask routes and queries → Division 1 season data: reads stats
app/app.py - Flask routes and queries → Division 2 season data: reads stats
app/app.py - Flask routes and queries → Division 1 game logs: reads game history
app/app.py - Flask routes and queries → Division 2 game logs: reads game history
app/app.py - Flask routes and queries → Leaderboard and profile views: renders pages
app/app.py