Discord · Node.js · TMDB API
A Discord bot that brings the full TMDB movie catalogue into your server. Search for any film with a single slash command and get an interactive poster collage back in seconds.
// flow
/movie// capabilities
Native Discord slash command integration gives auto-complete in
the command bar. No prefix to remember — just /movie and a title.
Search results render as a grid of up to four poster thumbnails pulled directly from TMDB, giving users an immediate visual scan rather than a wall of text.
Discord component buttons let users page through results, fetch more details, or dismiss the embed — all without leaving the chat window.
Powered by The Movie Database API — the same data source behind major streaming apps. Includes release year, overview text, and high-resolution artwork.
Missing posters, empty search results, and partial API responses are all handled cleanly so users always get a sensible reply rather than a broken embed.
Commands and events are loaded dynamically from separate module directories, making it straightforward to add new commands without touching core bot logic.
// under the hood
The bot follows the discord.js modular convention:
commands live in a commands/ directory and events in
events/. On startup, the client loader
walks both directories and registers each module dynamically —
no manual imports needed when adding new commands.
The two core events are ClientReady (registers slash commands with Discord's API on login) and InteractionCreate (dispatches incoming interactions to the correct command handler).
TMDB authentication uses a bearer token stored in environment
variables, keeping credentials out of source control. The
fs and path modules are used to build
dynamic file paths for the poster collage assembly step.
// Dispatch incoming interaction to correct handler export default { name: 'interactionCreate', async execute(interaction, client) { if (!interaction.isChatInputCommand()) return; const command = client.commands.get(interaction.commandName); if (!command) return; try { await command.execute(interaction); } catch (err) { console.error(err); await interaction.reply({ content: 'Something went wrong!', ephemeral: true }); } } };
// Fetch from TMDB and build embed const query = interaction.options.getString('title'); await interaction.deferReply(); const res = await fetch( `https://api.themoviedb.org/3/search/movie?query=${query}`, { headers: { Authorization: `Bearer ${process.env.TMDB_TOKEN}` } } ); const { results } = await res.json(); const top4 = results.slice(0, 4).filter(m => m.poster_path);
// stack
// roadmap
// source
The full source code is on GitHub — explore the codebase, open an issue, or fork it to build your own movie bot.