Back to articles
Build a Discord Bot That Roasts Your Code With AI

Build a Discord Bot That Roasts Your Code With AI

via Dev.to TutorialJoske Vermeulen

Every dev Discord server needs a code roast bot. Someone pastes a code snippet, the bot tears it apart with the energy of a senior developer who hasn't had coffee yet. It's educational, it's entertaining, and it's surprisingly easy to build. In this tutorial, we'll build a Discord bot that watches for code blocks in messages, reviews them with AI in a roast-style tone, and replies with brutally honest feedback. Think code review meets comedy. What we're building User : ! roast javascript function getUser(id) { var user = null; fetch('/api/users/' + id).then(res => { user = res.json(); }); return user; } Bot: 🔥 CODE ROAST 🔥 Oh no. Oh no no no. 1. You're returning `user` before the fetch completes. This function returns `null` every single time. You've built a function whose only job is to return null. Impressive. 2. `var` in 2026? Did you find this code in a time capsule? 3. `res.json()` returns a Promise too, which you're not awaiting. So even if the timing worked, `user` would be a Pr

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
2 views

Related Articles