Creating a Discord Bot With Lua: A Tutorial

BOT GITHUB: https://github.com/WiiShopChannel/Galaxy-Bot

Howdy! I’m Galaxy, a ROBLOX scripter and (self-appointed) Lua extraordinaire. Here’s a quick tutorial on how to get this bot running.

First, head over to https://discordapp.com/developers/applications/ and click New Application .

New Application

Second, give it a hot and spicy name and click Create

Third, give your bot some customization. It’s gotta be hip and cool for your discord buddies :sunglasses:

After your bot is to your liking, navigate over to Settings and click Bot , then click Add Bot . Remember, this action is irreversible .

Once you get your bot setup, navigate over to where your bot’s token is. Click copy to copy it to your clipboard.

After you have your token copied, open up your bot and edit bot.lua . I suggest using something like VS Code , Notepad++ , or Atom .

Scroll all the way down on bot.lua and on the last line you should see an area to put your token.

Simply put your token in and save the file.

Now you’re ready to start your bot! Go back to your bot folder and hit start.bat.

16 Likes

Since this is “a tutorial” like your title says you should move this to #resources:community-tutorials. Anyways this is such a nice tutorial! I didn’t know how to create a discord bot because I like just got it.

2 Likes

Could you tell us what the bot actually does?

This bot is a base for making your own, but at the moment the bot includes a help command, a ping command, and a lua code evaluator that can be used to execute lua code from discord using codeblocks.

I recommend using python or nodejs

Could you explain why using python or nodejs would be a better option?

1 Like

There is more resources for node.js and phyton and more things can be done with it while Lua isn’t so famous for building bots it can still be used

1 Like

I use it for @megatank58’s reason and I am more versed in nodeJS than I am in more advance lua.

1 Like

I would as well, however some users may not know JS or Python, and may not want to learn, so this is a good alternative. With that being said, It is completely recommended to make a bot in those languages if you don’t have a reliable way of hosting the luvit.exe that Discordia uses to run itself.

1 Like