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 Discord Developer Portal 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.

23 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

There is already a module called ‘Discordia’ for this, and it has been in development over the months and years.

Lua isn’t really an ideal language to make bots in. It doesn’t have some popular functions and methods that languages for example NodeJS have.
I learnt Lua in about 3 months, and after I have learnt it, I started learning JavaScript. Guess what? I knew the syntax and half of the methods in about 3-4 hours.
If you want to make a Discord bot just use Discord.JS, its a more popular and a really easy to learn library for bot development.

2 Likes

just because it’s not ideal doesn’t mean it can’t be done. some people may want to try it, whether it be a challenge or otherwise. i am simply providing an easy and understandable means of doing so

I’m not saying that it cannot be done?