Who's that Pokémon AI Guesser is a Discord bot that identifies Pokémon from images in real time using a locally trained image-classification model. It watches for messages from a specific bot account, and when one arrives carrying an embed announcing that a Pokémon has appeared, the bot pulls the attached image, runs it through the classifier and replies with the predicted species name in an embed of its own.
The inference path is deliberately lightweight. Images are fetched asynchronously over aiohttp, opened with Pillow and preprocessed into the shape the network expects — resized to 64×64, converted to a NumPy array, normalised to the 0–1 range and expanded with a batch dimension. A Keras model loaded from a bundled model.h5 produces a prediction vector, argmax selects the highest-scoring class, and the index is mapped back to a species name through a class-index JSON file saved at training time. A short randomised delay is inserted before replying so the bot's responses are not instantaneous and mechanically uniform.
Alongside the vision path there is a second, purely textual solver for cases where the source posts a masked hint such as c_ar_z_rd rather than an image. That branch converts the underscores into regular-expression wildcards and matches the pattern against a newline-delimited list of every Pokémon name using a multiline anchored search, returning any name of the right length whose revealed letters line up. Because a regex scan over the full name list is CPU-bound and would otherwise stall the event loop, it is dispatched to an executor rather than run inline.
The rest of the bot is the supporting scaffolding around those two paths: discord.py with full intents for the gateway connection, an aiosqlite database opened and initialised on ready, presence set to a watching activity, and a small Flask keep-alive server so the process survives on a free always-on host. It is a compact project, but an end-to-end one — a trained convolutional model, an asynchronous inference pipeline, a fallback heuristic and a deployment story all wired into a single running service.