search/
Start typing to search packages!
package_2
discord-luau
By @horsenuggets
Roblox
Mirroreddiscord-luau
A comprehensive Discord API library for Luau, inspired by discord.js.
Installation
Add to your wally.toml:
[dependencies]
Discord = "horsenuggets/discord-luau@0.1.9"
Quick Start
local Discord = require("@packages/Discord")
local process = require("@lune/process")
-- Create a client with intents
local client = Discord.Client.new({
intents = {
Discord.Intents.Guilds,
Discord.Intents.GuildMessages,
Discord.Intents.MessageContent,
},
})
-- Listen for ready event
client:On("ready", function()
print(`Logged in as {client.User:GetTag()}!`)
end)
-- Listen for messages
client:On("messageCreate", function(message)
if message.Content == "!ping" then
message:Reply("Pong!")
end
end)
-- Login with your bot token
client:Login(process.env.DISCORD_BOT_TOKEN)
Slash Commands
local Discord = require("@packages/Discord")
local process = require("@lune/process")
local client = Discord.Client.new({
intents = { Discord.Intents.Guilds },
})
-- Register commands when ready
client:On("ready", function()
-- Create a slash command using the builder
local pingCommand = Discord.SlashCommandBuilder.new()
:SetName("ping")
:SetDescription("Check bot latency")
local echoCommand = Discord.SlashCommandBuilder.new()
:SetName("echo")
:SetDescription("Echo a message")
:AddStringOption("message", "The message to echo", { required = true })
-- Register commands globally
client:SetGlobalCommands({ pingCommand, echoCommand })
print("Commands registered!")
end)
-- Handle interactions
client:On("interactionCreate", function(interaction)
if not interaction:IsCommand() then
return
end
if interaction.CommandName == "ping" then
interaction:Reply("Pong!")
elseif interaction.CommandName == "echo" then
local message = interaction:GetOption("message")
interaction:Reply(message)
end
end)
client:Login(process.env.DISCORD_BOT_TOKEN)
Embeds
local Discord = require("@packages/Discord")
local embed = Discord.Embed.new()
:SetTitle("Hello World")
:SetDescription("This is an embed!")
:SetColor(0x5865F2)
:AddField("Field 1", "Value 1", true)
:AddField("Field 2", "Value 2", true)
:SetFooter("Footer text")
:SetTimestamp()
-- Send embed with a message
message:Reply({ embeds = { embed:ToJSON() } })
-- Or in an interaction
interaction:Reply({ embeds = { embed:ToJSON() } })
Features
- Full Discord Gateway v10 support
- REST API for all Discord endpoints
- Event-driven architecture
- Comprehensive type definitions
- Slash commands and interactions
- Message components (buttons, select menus)
- Reactions and embeds
- Guild, channel, and user management
- Permission handling
- Rate limiting
Events
The client emits the following events:
ready- Bot is connected and readymessageCreate- New message receivedmessageUpdate- Message was editedmessageDelete- Message was deletedinteractionCreate- Slash command or component interactionguildCreate- Bot joined a guildguildDelete- Bot left a guildguildMemberAdd- Member joined a guildguildMemberRemove- Member left a guildchannelCreate- Channel was createdchannelUpdate- Channel was updatedchannelDelete- Channel was deletedmessageReactionAdd- Reaction added to a messagemessageReactionRemove- Reaction removed from a messagetypingStart- User started typingvoiceStateUpdate- Voice state changedpresenceUpdate- Presence changed
Package Details
Install command (Click to copy)
Version
0.1.9
License
MIT
Safe for commercial use
Automated license review — not legal advice.
