### Verifying Git Installation (bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/environment.mdx Executes the Git command-line interface to display the installed version, confirming that Git was successfully installed and is accessible in the system's PATH. ```bash git -v ``` -------------------------------- ### Verifying Rokit Installation (bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/environment.mdx Executes the Rokit command-line interface to display the installed version, confirming that Rokit was successfully installed and is accessible in the system's PATH. ```bash rokit -V ``` -------------------------------- ### Verifying Lune Installation (bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/environment.mdx Executes the Lune command-line interface to display the installed version, confirming that the runtime was successfully added and is accessible in the system's PATH. ```bash lune --version ``` -------------------------------- ### Example Rokit Configuration File (TOML) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/environment.mdx A sample `rokit.toml` file demonstrating how the required and optional tools (Lune, StyLua, Selene, Luau LSP) are declared with specific versions for project dependency management via Rokit. ```toml [tools] lune = "lune-org/lune@0.8.4" stylua = "JohnnyMorganz/StyLua@0.20.0" selene = "Kampfkarren/selene@0.27.1" luau-lsp = "JohnnyMorganz/luau-lsp@1.24.1" ``` -------------------------------- ### Adding Selene Linter with Rokit (bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/environment.mdx Uses the Rokit toolchain manager to add the Selene Luau linter to the project's dependencies. This installs Selene for code analysis. ```bash rokit add Kampfkarren/selene ``` -------------------------------- ### Example VS Code Settings File with Luau-LSP Directory Aliases (JSON) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/type-support.mdx View a complete example of a '.vscode/settings.json' file configured for Luau-LSP with directory aliases for both the Discord-Luau package and Lune typedefs. This demonstrates the expected final configuration after following the setup steps. ```json { "luau-lsp.require.mode": "relativeToFile", "luau-lsp.require.directoryAliases": { "@lune/": "~/.lune/.typedefs/0.8.2/", "@Builders": "DiscordLuau/Package/Classes/Builders", "@Network": "DiscordLuau/Package/Classes/Network", "@Objects": "DiscordLuau/Package/Classes/Objects", "@Data": "DiscordLuau/Package/Data", "@Enums": "DiscordLuau/Package/Enums", "@Std": "DiscordLuau/Package/Std", "@Utils": "DiscordLuau/Package/Utils", "@Vendor": "DiscordLuau/Package/Vendor" } } ``` -------------------------------- ### Adding StyLua Formatter with Rokit (bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/environment.mdx Uses the Rokit toolchain manager to add the StyLua Luau code formatter to the project's dependencies. This installs StyLua for automatic code formatting. ```bash rokit add JohnnyMorganz/stylua ``` -------------------------------- ### Initializing a Git Repository (Bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/installation.mdx Explains how to initialize a new Git repository in the current directory using the `git init` command. This is the first step before adding submodules and creates a hidden `.git` folder. ```bash git init ``` -------------------------------- ### Complete Slash Command Registration Example - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/commands.mdx Provides a full, runnable example script demonstrating the initialization of the DiscordLuau client, connecting to the `onReady` event, building necessary permissions, defining a simple "ping" slash command using the `CommandBuilder`, and registering the command with Discord. This snippet integrates the steps shown individually. Requires the DiscordLuau library and a valid bot token. ```Lua local DiscordLuau = require("DiscordLuau") local DiscordSettings = DiscordLuau.SettingsBuilder.new("") local DiscordClient = DiscordLuau.DiscordClient.new(DiscordSettings) -- Optionally enable verbose logging, to make it easier to debug DiscordClient:setVerbose(true) DiscordClient.eventManager.onReady:connect(function() print(`🎉🎉 {DiscordClient.discordUser.username} is online! 🎉🎉`) local permissions = DiscordLuau.PermissionsBuilder.new() :addPermission( DiscordLuau.PermissionsBuilder.Permissions.UseApplicationCommands ) -- Create a slash command using `CommandBuilder` local pingCommand = DiscordLuau.CommandBuilder .new() :setName("ping") :setDescription("Pong?") :setGuildPermissions(permissions) :addContext(DiscordLuau.CommandBuilder.Context.Guild) :setType(DiscordLuau.CommandBuilder.Type.ChatInput) -- Register our slash commands DiscordClient.discordApplication :setSlashCommandsAsync({ pingCommand }) :after(function(data) print("Registering slash commands...") DiscordClient.discordApplication:fetchSlashCommandsAsync():after(function(...) -- Optionally log information about our slash command print(...) end) end) end) ``` -------------------------------- ### Initializing Rokit in Directory (bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/environment.mdx Initializes the current working directory for use with Rokit, setting up necessary configuration files or structures. This is a prerequisite step before adding tools. ```bash rokit init ``` -------------------------------- ### Full Example: Replying with Attachment on Command (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/attachments.mdx A complete example combining bot initialization, event handling, attachment creation, and message replying. It listens for the `!embed` command, creates an attachment, builds a message with the attachment, and sends it as a reply. ```Lua local DiscordLuau = require("DiscordLuau") local DiscordSettings = DiscordLuau.SettingsBuilder.new("") local DiscordClient = DiscordLuau.DiscordClient.new(DiscordSettings) DiscordClient.eventManager.onMessage:connect(function(message) if message.Content == "!embed" then local responseMessage = DiscordLuau.MessageBuilder.new() local responseAttachment = DiscordLuau.AttachmentBuilder.new() :setName("example.txt") :setDescription("Example Text Document") :setData("Hello, World - 'Tis be the data of this example document!") message:replyAsync(responseMessage:addFile(responseAttachment)) end end) DiscordClient.eventManager.onReady:connect(function() print(`🎉🎉 {DiscordClient.discordUser.username} is online! 🎉🎉`) end) DiscordClient:connectAsync() ``` -------------------------------- ### Complete Example: Respond with Embed (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/embeds.mdx Provides the full, runnable code example that combines client initialization, event handling, embed creation, and replying within the `onMessage` event listener. It triggers the embed response when a specific command (`!embed`) is received. ```Lua local DiscordLuau = require("DiscordLuau") local DiscordSettings = DiscordLuau.SettingsBuilder.new("") local DiscordClient = DiscordLuau.DiscordClient.new(DiscordSettings) DiscordClient.eventManager.onMessage:connect(function(message) if message.Content == "!embed" then local responseMessage = DiscordLuau.MessageBuilder.new() local responseEmbed = DiscordLuau.EmbedBuilder.new() :setTitle("Example Embed") :setDescription("This is an example of an embed created using DiscordLuau!") :setColor(0xFF0000) :addField("Field 1", "Value 1", true) :addField("Field 2", "Value 2", true) :setFooter("This is a footer") message:replyAsync(responseMessage:addEmbed(responseEmbed)) end end) DiscordClient.eventManager.onReady:connect(function() print(`🎉🎉 {DiscordClient.discordUser.username} is online! 🎉🎉`) end) DiscordClient:connectAsync() ``` -------------------------------- ### Getting Invites Discord Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildTextChannel.mdx Gets the invites for the channel asynchronously. This method takes no arguments and returns a Future. ```Lua getInvitesAsync() ``` -------------------------------- ### Adding Discord-Luau as a Git Submodule (Bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/installation.mdx Demonstrates how to add the Discord-Luau repository as a submodule to the current Git project. It links the external repository and places it in a directory named `DiscordLuau`. ```bash git submodule add https://github.com/DiscordLuau/discord-luau.git DiscordLuau ``` -------------------------------- ### Getting Guild Preview DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Retrieves the preview information for the current guild asynchronously. Returns a Future resolving to an Objects.GuildPreview object. ```Lua function DiscordGuild:getPreviewAsync(): Vendor.Future ``` -------------------------------- ### Updating the Discord-Luau Git Submodule (Bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/installation.mdx Provides a sequence of commands to update the Discord-Luau submodule to the latest version from the 'Master' branch. It navigates into the submodule directory, switches to the 'Master' branch, pulls changes from the remote origin, and then returns to the parent directory. ```bash cd DiscordLuau git checkout Master git pull origin Master cd .. ``` -------------------------------- ### Getting Guild Channels DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Retrieves all channels in the guild asynchronously. Returns a Future resolving to a list of channels. ```Lua function DiscordGuild:getChannelsAsync(): Vendor.Future ``` -------------------------------- ### Getting Public Archived Threads Discord Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildTextChannel.mdx Gets all archived public threads in the guild channel asynchronously. This method accepts optional epoch (number) and limit (number) arguments and returns a Future resolving to a table of numbers. ```Lua getPublicArchivedThreadsAsync(epoch: number?, limit: number?) ``` -------------------------------- ### Getting Private Archived Threads Discord Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildTextChannel.mdx Gets all archived private threads in the guild channel asynchronously. This method accepts optional epoch (number) and limit (number) arguments and returns a Future resolving to a table of numbers. ```Lua getPrivateArchivedThreadsAsync(epoch: number?, limit: number?) ``` -------------------------------- ### Getting Joined Private Archived Threads Discord Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildTextChannel.mdx Gets all archived private threads that the bot is a member of, in the guild channel asynchronously. This method accepts optional epoch (number) and limit (number) arguments and returns a Future resolving to a table of numbers. ```Lua getJoinedPrivateArchivedThreads(epoch: number?, limit: number?) ``` -------------------------------- ### Method: getMessagesAsync (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildThread.mdx Gets messages from the channel asynchronously. Class: BaseGuildThread. Arguments: limit (number?). Returns: Vendor.Future. Inherited from Objects.BaseGuildTextChannel. ```Lua function BaseGuildThread:getMessagesAsync(limit: number?) -> Vendor.Future ``` -------------------------------- ### Getting Guild Audit Logs DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Retrieves the audit logs for the guild asynchronously. Returns a Future resolving to the audit log data. ```Lua function DiscordGuild:getGuildAuditLogs(): Vendor.Future ``` -------------------------------- ### Method: getMessageAsync (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildThread.mdx Gets a specific message from the channel asynchronously. Class: BaseGuildThread. Arguments: messageId (string). Returns: Vendor.Future. Inherited from Objects.BaseGuildTextChannel. ```Lua function BaseGuildThread:getMessageAsync(messageId: string) -> Vendor.Future ``` -------------------------------- ### Getting Automoderation Rule DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Retrieves a specific automoderation rule from the guild asynchronously using its rule ID. Returns a Future resolving to the rule object. ```Lua function DiscordGuild:getAutomoderationRuleAsync(ruleId: string): Vendor.Future ``` -------------------------------- ### Removing the Discord-Luau Git Submodule (Bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/installation.mdx Shows how to remove the Discord-Luau submodule from the Git repository. This command removes the submodule entry from the `.gitmodules` file and the index, but typically requires manual removal of the directory itself afterwards. ```bash git rm DiscordLuau ``` -------------------------------- ### Getting Guild Member DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Retrieves a specific member of the guild asynchronously using their user ID. Returns a Future resolving to the member object. ```Lua function DiscordGuild:getMemberAsync(userId: string): Vendor.Future ``` -------------------------------- ### Initialize and Configure OnboardingPromptOptionBuilder (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/OnboardingPromptOptionBuilder.mdx Demonstrates how to require the DiscordLuau library, create a new instance of OnboardingPromptOptionBuilder, and chain method calls like setTitle and setDescription to configure the option. ```lua local DiscordLuau = require("../Submodules/DiscordLuau") local OnboardingPromptOptionBuilder = DiscordLuau.OnboardingPromptOptionBuilder.new() :setTitle("option-name") :setDescription("Option Description!") ``` -------------------------------- ### Building an Onboarding Prompt - OnboardingPromptBuilder - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/OnboardingPromptBuilder.mdx Demonstrates how to initialize and configure an OnboardingPromptBuilder instance in Lua. It shows setting the prompt type to Dropdown and adding an option using OnboardingPromptOptionBuilder. ```lua local DiscordLuau = require("../Submodules/DiscordLuau") local OnboardingPromptBuilder = DiscordLuau.OnboardingPromptBuilder.new() :setType(DiscordLuau.OnboardingPromptBuilder.Type.Dropdown) :addOption( DiscordLuau.OnboardingPromptOptionBuilder.new() :setTitle("option-name") :setDescription("Option Description!") ) ``` -------------------------------- ### Initialize DiscordLuau Client and Connect (Luau) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/basic.mdx Requires the DiscordLuau submodule, creates a SettingsBuilder with the bot token, initializes a DiscordClient, and attempts to connect to the Discord websocket, printing a success message upon connection. ```lua local DiscordLuau = require("DiscordLuau") local DiscordSettings = DiscordLuau.SettingsBuilder.new("") local DiscordClient = DiscordLuau.DiscordClient.new(DiscordSettings) DiscordClient:connectAsync():after(function() print("We've connected to the Discord Websocket! 🚀") end) ``` -------------------------------- ### Initializing DiscordClient Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/DiscordClient.mdx Demonstrates how to require the DiscordLuau library and instantiate a new DiscordClient object using a SettingsBuilder. ```Lua local DiscordLuau = require("../Submodules/DiscordLuau") local SettingsBuilder = DiscordLuau.SettingsBuilder.new("BOT TOKEN") local DiscordClient = DiscordLuau.DiscordClient.new(SettingsBuilder) ``` -------------------------------- ### Initialize DiscordLuau Client and Events (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/embeds.mdx Sets up the DiscordLuau client with a provided token and connects basic event listeners for handling incoming messages (`onMessage`) and confirming client readiness (`onReady`). This is the initial step for any bot implementation. ```Lua local DiscordLuau = require("DiscordLuau") local DiscordSettings = DiscordLuau.SettingsBuilder.new("") local DiscordClient = DiscordLuau.DiscordClient.new(DiscordSettings) DiscordClient.eventManager.onMessage:connect(function(message) if message.content == "!embed" then ... end end) DiscordClient.eventManager.onReady:connect(function() print(`🎉🎉 {DiscordClient.discordUser.username} is online! 🎉🎉`) end) DiscordClient:connectAsync() ``` -------------------------------- ### Fetching Guild Onboarding - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches the onboarding configuration for this guild. Returns a Future resolving to a GuildOnboarding object. ```Lua function DiscordGuild:getGuldOnboardingAsync(): Vendor.Future ``` -------------------------------- ### Initializing DiscordLuau Client - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/commands.mdx Imports the DiscordLuau library, creates a settings object using the bot token, initializes the Discord client, and demonstrates how to enable verbose logging for debugging purposes. Requires the DiscordLuau library. ```Lua local DiscordLuau = require("DiscordLuau") local DiscordSettings = DiscordLuau.SettingsBuilder.new("") local DiscordClient = DiscordLuau.DiscordClient.new(DiscordSettings) -- Optionally enable verbose logging, to make it easier to debug DiscordClient:setVerbose(true) ``` -------------------------------- ### Initializing DiscordLuau Bot and Events (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/attachments.mdx Sets up a basic DiscordLuau bot instance, configures settings with a token, creates the client, and connects event handlers for incoming messages (`onMessage`) and bot readiness (`onReady`). Finally, it initiates the connection to Discord. ```Lua local DiscordLuau = require("DiscordLuau") local DiscordSettings = DiscordLuau.SettingsBuilder.new("") local DiscordClient = DiscordLuau.DiscordClient.new(DiscordSettings) DiscordClient.eventManager.onMessage:connect(function(message) if message.content == "!embed" then ... end end) DiscordClient.eventManager.onReady:connect(function() print(`🎉🎉 {DiscordClient.discordUser.username} is online! 🎉🎉`) end) DiscordClient:connectAsync() ``` -------------------------------- ### Building Welcome Screen with DiscordLuau Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/WelcomeScreenBuilder.mdx This snippet demonstrates how to initialize the WelcomeScreenBuilder in DiscordLuau and chain method calls to add a channel and set a description for a Discord guild's welcome screen. ```Lua local DiscordLuau = require("../Submodules/DiscordLuau") local WelcomeScreenBuilder = DiscordLuau.WelcomeScreenBuilder.new() :addChannel("1048686561685946489", "Super cool discord channel") :setDescription("Yeah, a super awesome dsicord channel!") ``` -------------------------------- ### Complete Basic DiscordLuau Application (Luau) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/basic.mdx Provides the complete code for a basic DiscordLuau application, including requiring the module, initializing the client, connecting to the 'Ready' event to print the bot's username, and initiating the connection to the Discord websocket. ```lua local DiscordLuau = require("DiscordLuau") local DiscordSettings = DiscordLuau.SettingsBuilder.new("") local DiscordClient = DiscordLuau.DiscordClient.new(DiscordSettings) DiscordClient.eventManager.onReady:connect(function() print("We've connected to the Discord Websocket! 🚀") end) DiscordClient:connectAsync():after(function() print("We've connected to the Discord Websocket! 🚀") end) ``` -------------------------------- ### Initializing OnboardingBuilder in Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/OnboardingBuilder.mdx This snippet demonstrates how to initialize a new OnboardingBuilder instance, set its mode, enable it, and add a channel ID using the DiscordLuau library. It requires the DiscordLuau module to be available. ```Lua local DiscordLuau = require("../Submodules/DiscordLuau") local OnboardingBuilder = DiscordLuau.OnboardingBuilder.new() :setMode(DiscordLuau.OnboardingBuilder.Mode.Default) :setEnabled(true) :addChannelId("1048686561685946489") ``` -------------------------------- ### Basic EmbedBuilder Usage (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/EmbedBuilder.mdx Demonstrates how to create a new EmbedBuilder instance and chain methods to set its properties like title, description, color, and add a field. ```Lua local embed = EmbedBuilder.new() :setTitle("Embed Title") :setDescription("This is an embed description.") :setColor(0x00FF00) :addField({name = "Field 1", value = "Value 1", inline = true}) ``` -------------------------------- ### Fetching Guild Welcome Screen - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches the welcome screen configuration for this guild. Returns a Future resolving to a GuildWelcomeScreen object. ```Lua function DiscordGuild:getGuildWelcomeScreenAsync(): Vendor.Future ``` -------------------------------- ### Connect to Discord 'Ready' Event (Luau) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/basic.mdx Connects a callback function to the DiscordClient's 'Ready' event, which fires when the bot successfully connects and is ready. The callback prints a message indicating the bot is online, including its username. ```lua DiscordClient.eventManager.onReady:connect(function() print(`{DiscordClient.discordUser.username} is online! 🎉`) end) ``` -------------------------------- ### Run DiscordLuau Application (Bash) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/basic.mdx Executes the Luau application script named 'application.luau' using the Lune runtime. ```bash lune run application.luau ``` -------------------------------- ### Initializing DiscordLuau SettingsBuilder in Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/SettingsBuilder.mdx Demonstrates the basic usage of the SettingsBuilder class to configure a Discord client. It shows how to require the library, create an IntentsBuilder instance, and then create a new SettingsBuilder instance with a bot token and the intents. ```Lua local DiscordLuau = require("../Submodules/DiscordLuau") local IntentsBuilder = DiscordLuau.IntentsBuilder.fromAll() local SettingsBuilder = DiscordLuau.SettingsBuilder.new("BOT TOKEN", IntentsBuilder) ``` -------------------------------- ### Building a Modal with ModalBuilder (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/ModalBuilder.mdx Demonstrates the basic usage of ModalBuilder to create a new modal instance, set its title, and add a component. ```lua local modal = ModalBuilder.new("modal_id") :setTitle("Example Modal") :addComponent(ButtonBuilder.new("button_id")) ``` -------------------------------- ### Create Discord Embed with EmbedBuilder (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/embeds.mdx Demonstrates how to use the `EmbedBuilder` class provided by DiscordLuau to construct a rich embed object. It shows how to set the title, description, color, add fields, and set a footer for the embed. ```Lua local responseEmbed = DiscordLuau.EmbedBuilder.new() :setTitle("Example Embed") :setDescription("This is an example of an embed created using DiscordLuau!") :setColor(0xFF0000) :addField("Field 1", "Value 1", true) :addField("Field 2", "Value 2", true) :setFooter("This is a footer") ``` -------------------------------- ### Constructing and configuring PresenceBuilder (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/PresenceBuilder.mdx Demonstrates the basic usage of PresenceBuilder to create a new presence object and chain methods to add activities, set status, AFK state, and update time. This is the standard way to build a presence configuration. ```Lua local presence = PresenceBuilder.new() :addActivity(ActivityBuilder.new():setActivityName("Playing a game")) :setStatus(PresenceBuilder.Status.Online) :setAfk(false) :setSince(os.time()) ``` -------------------------------- ### Creating and Configuring ActivityBuilder (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/ActivityBuilder.mdx Demonstrates how to create a new instance of the ActivityBuilder class and chain method calls to set the activity's name, type, and streaming URL. ```Lua local activity = ActivityBuilder.new() :setActivityName("Playing a game") :setActivityType(ActivityBuilder.Type.Game) :setStreamingURL("https://twitch.tv/example") ``` -------------------------------- ### Initializing MemberBuilder and setting nickname (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/MemberBuilder.mdx Demonstrates how to create a new MemberBuilder instance using the 'new' function and chain the 'setNickname' method to specify a new nickname for a member. ```lua local member = MemberBuilder.new() :setNickname("Discordian #0!") ``` -------------------------------- ### Connecting DiscordClient and Handling Result Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/DiscordClient.mdx Shows how to connect the DiscordClient to the Discord API using `connectAsync` and handle the connection completion using the `:after` method. ```Lua local DiscordClient = DiscordLuau.DiscordClient.new(SettingsBuilder) DiscordClient:connectAsync():after(function() print("Connected to the Discord API!") end) ``` -------------------------------- ### Function: new (SelectionBuilder) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx Creates a new instance of SelectionBuilder. ```Lua function SelectionBuilder.new(selectionId: string) ``` -------------------------------- ### Creating IntentsBuilder and Settings DiscordLuau Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/IntentsBuilder.mdx This snippet demonstrates how to require the DiscordLuau library, create an IntentsBuilder instance using the 'fromAll' function to include all intents, and then use this builder along with a bot token to create a DiscordSettings object. ```Lua local DiscordLuau = require("../Submodules/DiscordLuau") local IntentsBuilder = DiscordLuau.IntentsBuilder.fromAll() local DiscordSettings = DiscordLuau.DiscordSettings.new("BOT TOKEN", IntentsBuilder) ``` -------------------------------- ### Building a Discord Command using CommandBuilder (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/CommandBuilder.mdx This snippet demonstrates the basic usage of the CommandBuilder to create a new command object, setting its type, name, description, NSFW status, DM permission, default permission, and adding an option using CommandOptionBuilder. ```Lua local command = CommandBuilder.new() :setType(CommandBuilder.Type.ChatInput) :setName("example_command") :setDescription("This is an example command.") :setNSFW(false) :setDMPermission(true) :setDefaultPermissionEnabled(true) :addOption(CommandOptionBuilder.new():setType(CommandOptionBuilder.Type.String):setName("option1"):setDescription("An option")) ``` -------------------------------- ### Creating New DiscordApplication Instance - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordApplication.mdx Creates a new instance of the DiscordApplication class. Requires a Discord client instance and application data including id and flags. ```Lua DiscordApplication.new(discordClient: any The Discord client instance., applicationData: {id: string, flags: number} The application data.) ``` -------------------------------- ### Building a Command Option with CommandOptionBuilder in Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/CommandOptionBuilder.mdx Demonstrates how to create a new command option using the CommandOptionBuilder, chaining method calls to set its type, name, description, required status, and add choices. ```Lua local option = CommandOptionBuilder.new() :setType(CommandOptionBuilder.Type.String) :setName("example_option") :setDescription("This is an example option.") :setRequired(true) :addChoice("Choice 1", "value1") :addChoice("Choice 2", "value2") ``` -------------------------------- ### Handling Discord Client Ready Event - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/commands.mdx Connects a callback function to the `onReady` event of the Discord client's event manager. This function executes when the bot successfully connects to Discord and is ready, printing a confirmation message including the bot's username. Requires an initialized `DiscordClient`. ```Lua DiscordClient.eventManager.onReady:connect(function() print(`🎉🎉 {DiscordClient.discordUser.username} is online! 🎉🎉`) end) ``` -------------------------------- ### Modifying Guild Welcome Screen - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Updates the welcome screen configuration for this guild. Requires a 'welcomeScreenBuilder' object as input. Returns a Future that completes when the update operation is initiated. ```Lua function DiscordGuild:modifyGuildWelcomeScreenAsync(welcomeScreenBuilder: Builders.WelcomeScreenBuilder): Vendor.Future ``` -------------------------------- ### Creating a Discord Attachment (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/attachments.mdx Demonstrates how to construct a Discord attachment object using `AttachmentBuilder`. It shows how to set the file name, provide a description, and embed the file data directly as a string. ```Lua local responseAttachment = DiscordLuau.AttachmentBuilder.new() :setName("example.txt") :setDescription("Example Text Document") :setData("Hello, World - 'Tis be the data of this example document!") ``` -------------------------------- ### Initializing DiscordLuau AttachmentBuilder in Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/AttachmentBuilder.mdx This snippet demonstrates how to require the DiscordLuau library and create a new instance of the AttachmentBuilder. It then shows how to chain method calls to set the attachment's name and data. ```lua local DiscordLuau = require("../Submodules/DiscordLuau") local AttachmentBuilder = DiscordLuau.AttachmentBuilder.new() :setName("Example.txt") :setData("My Text Document!") ``` -------------------------------- ### Setting Slash Commands DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Sets multiple slash commands for the guild asynchronously, replacing existing ones. Requires a table of CommandBuilder objects. ```Lua function DiscordGuild:setSlashCommandsAsync(commands: {CommandBuilder}): Vendor.Future ``` -------------------------------- ### Creating Invite Discord Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildTextChannel.mdx Creates an invite for the channel asynchronously. This method accepts optional arguments for maxAge (number), maxUses (number), and temporary (boolean), and returns a Future. ```Lua createInviteAsync(maxAge: number?, maxUses: number?, temporary: boolean?) ``` -------------------------------- ### Building a Discord Message (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/MessageBuilder.mdx Demonstrates the basic usage of the MessageBuilder class in Lua, showing how to create a new instance and chain methods to set content, add embeds, components, sticker IDs, and enable TTS. ```lua local message = MessageBuilder.new() :setContent("Hello, world!") :addEmbed(EmbedBuilder.new():setTitle("Embed Title")) :addComponent(ButtonBuilder.new("button_id")) :addStickerId("sticker_id") :setTTSEnabled(true) ``` -------------------------------- ### Defining and Registering a Slash Command - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/commands.mdx Demonstrates how to create a slash command named "ping" with a description, set its required guild permissions, context, and integration type using the `CommandBuilder`. It then registers this command with Discord using `setSlashCommandsAsync` and includes optional logging after registration. Requires an initialized `DiscordClient`, `DiscordApplication` object, and a `PermissionsBuilder` instance. ```Lua -- Create a slash command using `CommandBuilder` local pingCommand = DiscordLuau.CommandBuilder .new() :setName("ping") :setDescription("Pong?") :setGuildPermissions(permissions) :addContext(DiscordLuau.CommandBuilder.Context.Guild) :addIntegration(DiscordLuau.CommandBuilder.IntegrationType.GuildCommand) -- Register our slash commands DiscordClient.discordApplication :setSlashCommandsAsync({ pingCommand }) :after(function(data) print("Registering slash commands...") DiscordClient.discordApplication:fetchSlashCommandsAsync():after(function(...) -- Optionally log information about our slash command print(...) end) end) ``` -------------------------------- ### Creating Guild Channel DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Creates a new channel within the guild asynchronously. Requires a Builders.ChannelBuilder object. ```Lua function DiscordGuild:createChannelAsync(channelBuilder: Builders.ChannelBuilder): Vendor.Future ``` -------------------------------- ### Fetching Guild Invites - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches all invite objects for the guild. Returns a Future resolving to an array of DiscordInvite objects. ```Lua function DiscordGuild:getGuildInvitesAsync(): Vendor.Future<{ Objects.DiscordInvite }> ``` -------------------------------- ### Fetching Slash Commands DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches all registered slash commands for the guild asynchronously. Returns a Future resolving to a list of commands. ```Lua function DiscordGuild:fetchSlashCommandsAsync(): Vendor.Future ``` -------------------------------- ### Fetching Guild Widget Image - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches the binary PNG image data for the guild widget in a specified style. Requires 'style' (string literal) as input. Returns a Future resolving to a string containing the binary image data. ```Lua function DiscordGuild:getGuildWidgetImageAsync(style: 'shield' | 'banner1' | 'banner2' | 'banner3' | 'banner4'): Vendor.Future ``` -------------------------------- ### Fetching Guild Integrations - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches all integration objects for the guild. Returns a Future resolving to an array of DiscordIntegration objects. ```Lua function DiscordGuild:getGuildIntegrationsAsync(): Vendor.Future<{ Objects.DiscordIntegration }> ``` -------------------------------- ### Reply to Message with Embed (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/embeds.mdx Shows the process of creating a `MessageBuilder`, adding a previously constructed embed object to it, and using the `replyAsync` method on the original message object to send the embed as a response. ```Lua local responseMessage = DiscordLuau.MessageBuilder.new() local responseEmbed = DiscordLuau.EmbedBuilder.new() :setTitle("Example Embed") :setDescription("This is an example of an embed created using DiscordLuau!") :setColor(0xFF0000) :addField("Field 1", "Value 1", true) :addField("Field 2", "Value 2", true) :setFooter("This is a footer") message:replyAsync(responseMessage:addEmbed(responseEmbed)) ``` -------------------------------- ### Fetching Slash Commands - DiscordApplication Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordApplication.mdx Fetches all existing slash commands for the Discord application. Returns a Future containing a table of ApplicationCommand objects. ```Lua DiscordApplication.fetchSlashCommandsAsync() -> Vendor.Future<{ApplicationCommand}> ``` -------------------------------- ### Configuring Discord-Luau Directory Aliases in VS Code Settings (JSON) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/type-support.mdx Populate the 'luau-lsp.require.directoryAliases' object with key-value pairs mapping the alias names (e.g., '@Builders') to their corresponding relative paths within the Discord-Luau package structure. This allows Luau-LSP to resolve module paths correctly. ```json "@Builders": "DiscordLuau/Package/Classes/Builders", "@Network": "DiscordLuau/Package/Classes/Network", "@Objects": "DiscordLuau/Package/Classes/Objects", "@Data": "DiscordLuau/Package/Data", "@Enums": "DiscordLuau/Package/Enums", "@Std": "DiscordLuau/Package/Std", "@Utils": "DiscordLuau/Package/Utils", "@Vendor": "DiscordLuau/Package/Vendor" ``` -------------------------------- ### Set Default Discord Intents (Luau) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/basic.mdx Creates a DiscordSettings object with the bot token and explicitly sets the default Discord intents using the IntentsBuilder. This is necessary if the bot requires specific permissions or events. ```lua local DiscordSettings = DiscordLuau.SettingsBuilder.new("", DiscordLuau.IntentsBuilder.fromDefault()) ``` -------------------------------- ### Building a Guild Role using GuildRoleBuilder Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/GuildRoleBuilder.mdx This snippet demonstrates how to create a new instance of the GuildRoleBuilder and chain method calls to set common properties like name, color, hoisted status, and mentionability before potentially sending it to the Discord API. ```lua local DiscordGuild = GuildRoleBuilder.new() :setName("my-discord-role") :setColor(0xFF0000) :setHoisted(true) :setMentionable(false) ``` -------------------------------- ### Listing Automoderation Rules DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Lists all automoderation rules configured for the guild asynchronously. Returns a Future resolving to a list of rules. ```Lua function DiscordGuild:listAutomoderationRulesAsync(): Vendor.Future ``` -------------------------------- ### Creating Slash Command - DiscordApplication Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordApplication.mdx Creates a new slash command for the Discord application. Requires a CommandBuilder.CommandBuilder object representing the command data. ```Lua DiscordApplication.createSlashCommandAsync(command: CommandBuilder.CommandBuilder The command to create.) -> Vendor.Future ``` -------------------------------- ### Fetching Guild Members DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches members of the guild asynchronously, with optional pagination. Takes a limit and an optional last user ID. ```Lua function DiscordGuild:fetchGuildMembersAsync(limit: number, lastUserId: number?): Vendor.Future ``` -------------------------------- ### Method: toPayloadObject (SelectionBuilder) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx Converts the selection to a JSON object that can be sent to the Discord API. ```Lua function SelectionBuilder:toPayloadObject(): Network.Resolvable ``` -------------------------------- ### Adding Empty Directory Aliases Object in VS Code Settings (JSON) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/getting-started/type-support.mdx Add the 'luau-lsp.require.directoryAliases' object to your '.vscode/settings.json' file. This object is necessary for Luau-LSP to recognize and process directory aliases used by the Discord-Luau package. ```json "luau-lsp.require.directoryAliases": { } ``` -------------------------------- ### Creating and configuring PermissionsBuilder instance (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/PermissionsBuilder.mdx This snippet demonstrates how to create a new PermissionsBuilder instance, add specific permissions using the addPermission method and the Permissions enumeration, and then retrieve the combined permission value as a bitfield string using getValue. ```lua local permissions = PermissionsBuilder.new() :addPermission(PermissionsBuilder.Permissions.Administrator) :addPermission(PermissionsBuilder.Permissions.ManageChannels) print(permissions:getValue()) ``` -------------------------------- ### Fetching Guild Widget Settings - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches the widget settings for the current guild. Returns a Future resolving to an object containing 'enabled' (boolean) and 'channelId' (string) properties. ```Lua function DiscordGuild:getGuildWidgetSettingsAsync(): Vendor.Future<{ enabled: boolean, cannelId: string }> ``` -------------------------------- ### Fetching Guild Vanity URL - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches the vanity URL information for this guild. Returns a Future resolving to an object containing the 'code' (string) and 'uses' (number). ```Lua function DiscordGuild:getGuildVanityUrlAsync(): Vendor.Future<{ code: string, uses: number }> ``` -------------------------------- ### Creating Automoderation Rule DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Creates a new automoderation rule in the guild asynchronously. Requires an AutomoderationRuleBuilder object. ```Lua function DiscordGuild:createAutomoderationRuleAsync(getAutomoderationRuleBuilder: AutomoderationRuleBuilder): Vendor.Future ``` -------------------------------- ### Fetching Guild Bans - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches an array of Guild Bans. Accepts optional parameters for pagination: 'limit' (number), 'before' (string), and 'after' (string). Returns a Future resolving to an array of DiscordGuildBan objects. ```Lua function DiscordGuild:getGuildBansAsync(limit: number?, before: string?, after: string?): Vendor.Future<{ Objects.DiscordGuildBan }> ``` -------------------------------- ### Fetching Guild Channels DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches all channels belonging to the guild asynchronously. Returns a Future resolving to a list of channels. ```Lua function DiscordGuild:fetchGuildChannelsAsync(): Vendor.Future ``` -------------------------------- ### Adding Member To Guild DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Adds a user to the guild asynchronously using their user ID and an access token. Returns a Future resolving to the new member's DiscordChannel object. ```Lua function DiscordGuild:addMemberAsync(userId: string, accessToken: string): Vendor.Future<{ Objects.DiscordChannel }> ``` -------------------------------- ### Setting Slash Commands - DiscordApplication Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordApplication.mdx Sets the slash commands for the Discord application, updating existing ones and creating or deleting as necessary. Requires a table of CommandBuilder.CommandBuilder objects. ```Lua DiscordApplication.setSlashCommandsAsync(commands: {CommandBuilder.CommandBuilder} The list of commands to set.) -> Vendor.Future ``` -------------------------------- ### Fetching Guild Widget - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches the guild widget object for this guild. Returns a Future resolving to a GuildWidget object. ```Lua function DiscordGuild:getGuldWidgetAsync(): Vendor.Future ``` -------------------------------- ### Method: addChoice (SelectionBuilder) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx Adds a choice to the selection. ```Lua function SelectionBuilder:addChoice(choiceName: string, choiceValue: string, choiceDescription: string, isDefault: boolean, emojiId: string?, emojiName: string?): Builders.Interface.SelectionBuilder ``` -------------------------------- ### Method: resumeAsync (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Resumes a previously established voice connection asynchronously. Returns a Future that resolves upon successful resumption. ```Lua function DiscordVoiceConnection:resumeAsync(self: DiscordVoiceConnection): Vendor.Future ``` -------------------------------- ### Property: SelectionBuilder.ChannelType (table) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx An enumeration of channel types. ```Lua SelectionBuilder.ChannelType: table ``` -------------------------------- ### Method: setPlaceholder (SelectionBuilder) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx Sets the placeholder text for the selection. ```Lua function SelectionBuilder:setPlaceholder(placeholderText: string): Builders.Interface.SelectionBuilder ``` -------------------------------- ### Searching Guild Members DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Searches for members in the guild asynchronously based on a query string, with an optional limit on results. ```Lua function DiscordGuild:searchGuildMembersAsync(query: string, limit: number?): Vendor.Future ``` -------------------------------- ### Method: connectAsync (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Connects to a voice channel asynchronously using the provided guild and channel IDs. Returns a Future that resolves upon successful connection. ```Lua function DiscordVoiceConnection:connectAsync(self: DiscordVoiceConnection, guildId: string, channelId: string): Vendor.Future ``` -------------------------------- ### Property: reporter (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Represents the console reporter used for logging within the DiscordVoiceConnection class. It is of type Vendor.Console. ```Lua DiscordVoiceConnection.reporter: Vendor.Console ``` -------------------------------- ### Method: setMinValues (SelectionBuilder) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx Sets the minimum number of values that must be selected. ```Lua function SelectionBuilder:setMinValues(minValue: number): Builders.Interface.SelectionBuilder ``` -------------------------------- ### Building Permissions for Slash Commands - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/commands.mdx Creates a new `PermissionsBuilder` instance and adds the `UseApplicationCommands` permission. This builder is used to define the required guild permissions for the slash command. Requires the `DiscordLuau.PermissionsBuilder` class. ```Lua local permissions = DiscordLuau.PermissionsBuilder.new() :addPermission( DiscordLuau.PermissionsBuilder.Permissions.UseApplicationCommands ) ``` -------------------------------- ### Replying with a Discord Attachment (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/guides/attachments.mdx Illustrates the process of creating a message containing an attachment and sending it as a reply to an incoming message. It uses `MessageBuilder` to add the `AttachmentBuilder` object and then calls the `replyAsync` method on the original message object. ```Lua local responseMessage = DiscordLuau.MessageBuilder.new() local responseAttachment = DiscordLuau.AttachmentBuilder.new() :setName("example.txt") :setDescription("Example Text Document") :setData("Hello, World - 'Tis be the data of this example document!") message:replyAsync(responseMessage:addFile(responseAttachment)) ``` -------------------------------- ### Method: setChannelTypes (SelectionBuilder) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx Sets the channel types for the selection. ```Lua function SelectionBuilder:setChannelTypes(...: number): Builders.Interface.SelectionBuilder ``` -------------------------------- ### Method: heartbeatIn (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Schedules the next heartbeat to be sent after a specified interval in milliseconds. This manages the timing of subsequent heartbeats. ```Lua function DiscordVoiceConnection:heartbeatIn(self: DiscordVoiceConnection, milliseconds: number) ``` -------------------------------- ### Method: setMaxValues (SelectionBuilder) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx Sets the maximum number of values that can be selected. ```Lua function SelectionBuilder:setMaxValues(maxValue: number): Builders.Interface.SelectionBuilder ``` -------------------------------- ### Method: observeWebsocketOperations (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Observes and handles operations received from the voice websocket. This method processes incoming data and events. ```Lua function DiscordVoiceConnection:observeWebsocketOperations(self: DiscordVoiceConnection) ``` -------------------------------- ### Setting Guild MFA Level - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Sets the guild's MFA level. Requires the 'mfaLevel' (number) as input. Returns a Future that completes when the operation is initiated. ```Lua function DiscordGuild:setMFALevelAsync(mfaLevel: number): Vendor.Future ``` -------------------------------- ### Property: SelectionBuilder.Type (table) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx An enumeration of selection types. ```Lua SelectionBuilder.Type: table ``` -------------------------------- ### Method: joinThreadAsync (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildThread.mdx Joins the current discord bot into the thread. Class: BaseGuildThread. Arguments: None. Returns: Vendor.Future. ```Lua function BaseGuildThread:joinThreadAsync() -> Vendor.Future ``` -------------------------------- ### Fetching Active Guild Threads DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches all currently active threads within the guild asynchronously. Returns a Future resolving to a table of DiscordChannel objects. ```Lua function DiscordGuild:getActiveGuildThreads(): Vendor.Future<{ Objects.DiscordChannel }> ``` -------------------------------- ### Fetching All Guild Roles - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches all roles within the guild. This method appears to be misnamed in the source documentation. Returns a Future resolving to an array of DiscordGuildRole objects. ```Lua function DiscordGuild:bulkGuildBanAsync(): Vendor.Future<{ Objects.DiscordGuildRole }> ``` -------------------------------- ### Property: availableTags (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildThread.mdx Represents the available tags for the thread. Type: { { id: string, name: string, moderated: boolean, emojiId: string?, emojiName: string? } }. ```Lua availableTags: { { id: string, name: string, moderated: boolean, emojiId: string?, emojiName: string? } } ``` -------------------------------- ### Setting Position Discord Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildTextChannel.mdx Sets the position of the channel asynchronously. This method requires a position (number) and accepts optional parentId (string) and syncPermissions (boolean), returning a Future. ```Lua setPositionAsync(position: number, parentId: string?, syncPermissions: boolean?) ``` -------------------------------- ### Property: appliedTags (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildThread.mdx Represents the applied tags for the thread. Type: { string }. ```Lua appliedTags: { string } ``` -------------------------------- ### Modifying Guild Settings DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Modifies the settings of the guild asynchronously. Requires a Builders.GuildBuilder object specifying the changes. ```Lua function DiscordGuild:modifyAsync(guildBuilder: Builders.GuildBuilder): Vendor.Future ``` -------------------------------- ### Fetching Guild Voice Regions - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches the available voice regions for the guild. Returns a Future resolving to an array of objects, each describing a voice region with properties like id, name, optimal, deprecated, and custom. ```Lua function DiscordGuild:getGuildVoiceRegionsAsync(): Vendor.Future<{ { id: string, name: string, optimal: boolean, deprecated: boolean, custom: boolean } }> ``` -------------------------------- ### Method: triggerTypingIndicator (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildThread.mdx Triggers the typing indicator in the channel. Class: BaseGuildThread. Arguments: None. Returns: Vendor.Future. Inherited from Objects.BaseGuildTextChannel. ```Lua function BaseGuildThread:triggerTypingIndicator() -> Vendor.Future ``` -------------------------------- ### Method: observeWebsocketErrors (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Observes and handles errors from the voice websocket. This method is internal to the DiscordVoiceConnection class. ```Lua function DiscordVoiceConnection:observeWebsocketErrors(self: DiscordVoiceConnection) ``` -------------------------------- ### Updating Guild Widget Settings - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Updates the widget settings for the current guild. Requires 'widgetEnabled' (boolean) and 'channelId' (string) as input. Returns a Future resolving to the updated settings object. ```Lua function DiscordGuild:updateGuildWidgetSettingsAsync(widgetEnabled: boolean, channelId: string): Vendor.Future<{ enabled: boolean, cannelId: string }> ``` -------------------------------- ### Editing Slash Command DiscordGuild Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Edits an existing slash command in the guild asynchronously. Requires the command ID and a CommandBuilder object. ```Lua function DiscordGuild:editSlashCommandAsync(commandId: string, command: CommandBuilder): Vendor.Future ``` -------------------------------- ### Property: encryptionKey (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Stores the encryption key used for voice communication. It is a buffer. ```Lua DiscordVoiceConnection.encryptionKey: buffer ``` -------------------------------- ### Property: voiceUDP (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Represents the voice UDP connection managed by the DiscordVoiceConnection class. It is of type Network.VoiceUDP. ```Lua DiscordVoiceConnection.voiceUDP: Network.VoiceUDP ``` -------------------------------- ### Method: setType (SelectionBuilder) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Builders/Interface/SelectionBuilder.mdx Sets the type of the selection. ```Lua function SelectionBuilder:setType(selectionType: number): Builders.Interface.SelectionBuilder ``` -------------------------------- ### Property: lastPinTimestamp (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildThread.mdx Represents the timestamp of the last pinned message. Type: string. Inherited from Objects.BaseGuildTextChannel. ```Lua lastPinTimestamp: string ``` -------------------------------- ### Method: getThreadMemberAsync (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/BaseGuildThread.mdx Returns a list of members that are active in the current thread channel. Class: BaseGuildThread. Arguments: userId (string). Returns: Vendor.Future<{ DiscordGuildMember }>. ```Lua function BaseGuildThread:getThreadMemberAsync(userId: string) -> Vendor.Future<{ DiscordGuildMember }> ``` -------------------------------- ### Fetching Specific Guild Ban - DiscordGuild - Lua Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Objects/DiscordGuild.mdx Fetches the ban object for a specific user ID. Requires the 'userId' (string) as input. Returns a Future resolving to a DiscordGuildBan object or nil if not found. ```Lua function DiscordGuild:getGuildBanAsync(userId: string): Vendor.Future ``` -------------------------------- ### Property: voiceWebsocket (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Represents the voice websocket connection managed by the DiscordVoiceConnection class. It is of type Network.DiscordWebsocket. ```Lua DiscordVoiceConnection.voiceWebsocket: Network.DiscordWebsocket ``` -------------------------------- ### Property: heartbeatPing (Lua) Source: https://github.com/discordluau/docs/blob/master/src/content/docs/classes/Network/DiscordVoiceConnection.mdx Stores the ping time for heartbeats. It is an optional number. ```Lua DiscordVoiceConnection.heartbeatPing: number? ```