DEV Community

Cover image for Build a Discord Bot in Minutes!
GhostOperator
GhostOperator

Posted on

Build a Discord Bot in Minutes!

Want to build a fully customized discord bot? I promise you're going to like this!

I built my first Leveling Discord Bot with Autocode. It's a really amazing bot, including other features like Moderation, Server Config and Log System, besides my bot is hosted 24/7 for free! Yeah, I know, cool right?

What is Autocode?

Autocode is an online node allowing you to speed-run your codes in JavaScript without being worried about hosting, web-sockets or re-connections. You can use Autocode to connect with Discord, Minecraft, Roblox, Google and many more other services. And building your custom discord bot using Autocode is going to be a kid game for you, even if it's your first time to build a bot!

How do I build my bot?

It's easy! There are simple steps to follow.

Autocode Sign-Up page

  • Create your Discord Bot

To create your bot, go to your Discord Developers Portal and click on New Application

Discord Developer Portal

  • Choose a name for your bot

Give your bot a name

  • Head to the Bots tab and click the Add Bot button

Add a bot to your Application

  • Make sure to enable to presence intents (Important for majors bot actions) Presence Intents

Images and assets by Scott Gamble

For full guide, check How to build a Discord bot with Node.JS

Once you're done with linking your bot, you can build a basic ping, pong command, it should look like this

const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});

await lib.discord.channels['@0.2.2'].messages.create({
  channel_id: context.params.event.channel_id,
  content: `Pong!`
});```



```
{% endraw %}


{% raw %}`const lib`{% endraw %} access the autocode library
{% raw %}`token`{% endraw %} process your bot's token from environmental variables
{% raw %}`await lib.discord` is the api accessed from the library allowing your bot to use `message.create` that is what makes your bot to send messages in your server when running your command, this case your bot will be replying with `Pong!`.

This was a pretty cool walktrough for you, don't forget to consult the full [guide](https://autocode.com/guides/how-to-build-a-discord-bot/) and to join Autocode [Discord Community](https://discord.gg/autocode)
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
bttcsupport profile image
Bittorrent chain Support

Please i need a discord developer can anyone contact me via jeffjrico@gmail.com

Collapse
 
elijahwilliams profile image
GhostOperator

Bet!