Discord4u is an abstracted Discord bot library for Luau.
I've been going though some major Luau burnout recently, thankfully it is slowly going away, I won't make any soild promises but I hope to finally get this library into a working/deployable state sometime after the new year. I plan on finally cleaning up the codebase and slightly changing how you write bots in Discord4u.
-- Proposed 4u rewrite
local process = require("@lune/process")
local Discord = require("@Discord/")
local CommandBuilder = Discord.CommandBuilder
local client = Discord.client({auth = process.env.DISCORD_TOKEN})
local event = client.event
local pingpong = CommandBuilder.new("SLASH_COMMAND")
:setName("ping")
:setDescription("Responds with \"Pong!\" if successful.")
event.ready:Connect(function()
-- registering commands is no longer needed
end)
pingpong:Connect(function(interaction)
interaction:reply("Pong!")
end)
The short answer is no, the long answer is that its experimental, and basically untested besides short ~10 min tests i've been doing on a server.
TLDR: It's not really on par with discord.js or discord.py or discord.net or even Discord Luau but hey, it can at least send messages!
- Websockets "work" (load-bearing air quotes). It's not close to completion, but if you're not afraid to get your hands dirty with this, you can handle most events.
- The REST/HTTPS API is practically just a two net requests at this point
- The codebase is absolutely unstable
- It doesn't rate limit (from my testing) 😲
Its not very pretty, but weirdly its also kinda fine at the same time. I'll clean it up later. Or you reading this can contribute.
To learn the Discord API, because apparently, I hate myself. While I know there are other Luau Discord bot frameworks I decided to make this to learn how to work with the Discord API without using already built libraries.