How farmernettw/mybot works
This repository is a Discord bot for Taiwanese transit, weather, and MyGo meme lookups. Discord users invoke commands or mention the bot; the relevant Cog fetches and interprets data, then sends a response through Discord. Transit and YouBike use TDX, while weather queries the Central Weather Administration. Meme search tokenizes keywords, searches a local inverted index, ranks image metadata, and returns an image view. The README documents the bus, YouBike, and weather capabilities; sampled source also shows the MyGo search feature. Some internal wiring is omitted where excerpts do not establish it.
Main entry points: main.py Bot entry · ubike.py YouBike lookup · __init__.py Meme commands · search_engine.py Meme search
Components 16
Bot runtime
- Bot entry
main.py - Bot settings
cfg.yml
Transit lookups
- Bus routes
Cogs/bus.py - YouBike lookup
Cogs/ubike.py - TDX client
Cogs/bus.py
Weather lookup
- Weather forecast
Cogs/weather.py
Meme search
- Meme commands
Cogs/mygo/__init__.py - Meme search
Cogs/mygo/search_engine.py - Image metadata
Cogs/mygo/data/image_map.json - Inverted index
Cogs/mygo/database/inverted_index.json - Search tags
Cogs/mygo/database/tags.json
Other components
- Discord user
- Discord platform
- TDX API
- CWA API
- Meme image host
Connections 25
- Discord user → Discord platform: invokes
- Discord platform → Bot entry: delivers events
- Bot entry → Bot settings: reads settings
- Bot entry → Bus routes: loads Cog
- Bot entry → YouBike lookup: loads Cog
- Bot entry → Weather forecast: loads Cog
- Bot entry → Meme commands: loads Cog
- Discord platform → Bus routes: dispatches command
- Bus routes → TDX client: requests route data
- TDX client → TDX API: fetches data
- Bus routes → Discord platform: sends route results
- Discord platform → YouBike lookup: dispatches command
- YouBike lookup → TDX client: requests station data
- YouBike lookup → TDX client: requests availability
- YouBike lookup → Discord platform: sends station status
- Discord platform → Weather forecast: dispatches command
- Weather forecast → CWA API: requests forecast
- Weather forecast → Discord platform: sends forecast
- Discord platform → Meme commands: dispatches search
- Meme commands → Meme search: searches keyword
- Meme search → Image metadata: loads metadata
- Meme search → Inverted index: loads index
- Meme search → Search tags: loads tags
- Meme commands → Meme image host: embeds image
- Meme commands → Discord platform: replies with result