Back to blog

How to Build a Discord Bot with Lazy

by
Caleb Sakala
March 4, 2024
Create app
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

“Much of my work has come from being lazy. I didn’t like writing programs, and so…I started work on a programming system to make it easier to write programs.”

John Backus, Creator of FORTRAN

Typical lazy person. They're always creating their own programming systems. 

If you’ve been coding long enough to recognise where I stole that joke from, you also know that in that same video, it was said that many consider the holy grail of programming to be the use of plain English, where you can just speak what you want the computer to do, it figures the code out and executes it.

Ladies and gentlemen, I have discovered the holy grail of programming - and its name is Lazy AI.

Now at this point you might be wondering, “Isn’t this just another cheap ChatGPT wrapper?” and you’d be justified in suspecting that - but you’d be completely wrong. This is so much greater, this is something that takes the experience of software development and wraps it in a code editor that has all your favourite shortcuts, version control, automatic deployment to the cloud and an ever-present AI colleague that can create and modify your project’s codebase - at your command. And if you aren’t amazed yet, allow me to demonstrate its utility with a mini-tutorial on how to build the first thing I ever tried to build with Lazy AI:

A Discord bot. 

I’d never built one before but I clearly remember watching a loading spinner on the Lazy AI website thinking, “How hard could it be” merely moments before the code of my first Discord bot appeared in front of me. I kid you not, the sheer volume of the lines of code, the package names and the - actually helpful - comments filled me with both grief for all the things I’d ever learned how to do manually, and an awe at the realisation that I was staring into a future where there is nothing I cannot do. 

A lot has happened since then and today, I can build a Discord bot in seven minutes - maybe even in one minute. And I’m going to teach you my secret recipe. The 1-minute Discord bot, we’ll call it. We’re going to build a customisable Discord bot that talks to you with Lazy AI.

1-minute Discord bot with Lazy AI

Your main ingredients:

  1. You need a Discord bot token. 

I had no idea what a Discord bot token was before the day I tried to build a Discord bot - and you’ll have to get that from Discord’s Developer Portal, not from Lazy AI. This step-by-step guide on how to get a bot token was helpful (alternatively, you can watch me set it up here). 

For this simple Discord bot, a bot token is all you’ll need to start cooking!

Step-by-step instructions:

You’ll need to start by giving Lazy AI a “prompt” of what you want to build. I’ve found that a conversational tone works just fine. I’ll show you why I call it the one-minute Discord bot in a second but just so you can see what went into it, here was my first prompt:

Hey, Lazy. Could you please help me create a Discord bot that talks to people? I should be able to talk to it like I talk to any other person on Discord. When I use the "!chat" command in a public channel, it should respond to whatever I say - and when I speak to it in a private message, it should reply to everything I say”. 

Believe it or not, this was enough to build a basic version of the bot. My next prompt was: 

Add a new environment secret that allows users to set how many responses per minute the bot should be able to give. The default should be 1. Then implement the limiting to ensure that the bot stays within the certain limit and replies with ‘Sorry, I can only respond to {x} message(s) per minute. Please wait {x} amount of time.’"

Awesome. And I didn’t stop there. When feature addition is as easy as typing a clear instruction, trust me - you can get carried away. 

Now, if you want to create your own Discord bot from scratch, that’s fine (according to timestamps from Lazy AI, I built this bot in two hours). However, I neatly packed my hours of work into a totally free, customizable template for you here. And this is the reason I call it the 1-minute Discord bot - because, with Lazy AI you can start building from templates built by other community members. The profoundness of this approach is that when someone like me publishes a web app as a community template, its core functionality is generalized into something that can be customized by someone like you to do exactly what you need it to do, simply by starting from my template and telling Lazy what you want to add or change or by using my template as is. 

With my template “Discord bots that talk to you”, you can make a Discord bot in one minute.   

So the step-by-step instructions for the 1-minute Discord bot are: 

  1. Navigate to my customizable template (which comes with a walkthrough video on how to set it up)
  2. Press “Start with this template” (to create your personal version of it)
  3. Copy your bot token into the “Env Secrets” tab (under DISCORD_BOT_TOKEN) and save
  4. Invite your bot to your server (I show how to do this in the walkthrough)
  5. Click on “Test” or “Test your app” (bottom left if you’re on PC) and then press “Run” to run your web app
  6. Voila! Your Discord bot should be online; you and your server members can use it as much as you like! You can also customise my template by making your bot say and behave however you want it to behave simply by navigating to your personal version of the template from step 2 and telling Lazy what you want to change.

Congratulations, you just learned how to build a Discord bot! 

P.S. If you’re reading this and you had a problem creating your Discord bot, you can find me in Lazy AI’s official Discord. I’d be happy to troubleshoot it with you. Congrats again! You have taken the first step in leveraging AI to build production-ready software 10X faster.

Related posts

Home
/
Blog
/
How to Build a Discord Bot with Lazy