Build a Discord Bot in Minutes!
GhostOperator
Posted on December 16, 2021
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.
- Create your Autocode account
- Create your Discord Bot
To create your bot, go to your Discord Developers Portal and click on New Application
- Choose a name for your bot
- Head to the Bots tab and click the Add Bot button
- Make sure to enable to presence intents (Important for majors bot actions)
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)
Posted on December 16, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.