Skip to content

DiscordClient

The base class that implements the various properties, methods, and events that developers can use to interact with the Discord API.

local DiscordLuau = require("../Submodules/DiscordLuau")
local SettingsBuilder = DiscordLuau.SettingsBuilder.new("BOT TOKEN")
local DiscordClient = DiscordLuau.DiscordClient.new(SettingsBuilder)

Properties

eventManager

DiscordClient.eventManager  :: Objects.EventManager

discordGateway

DiscordClient.discordGateway  :: Objects.DiscordGateway

onEvent

DiscordClient.onEvent  :: Vendor.Signal<string, { [any]: any }?>

discordSettings

DiscordClient.discordSettings  :: SettingsBuilder

discordCache

DiscordClient.discordCache  :: DiscordCache

reporter

DiscordClient.reporter  :: Vendor.Reporter

websocketUrl

DiscordClient.websocketUrl  :: string

shardCount

DiscordClient.shardCount  :: number

maxConcurrency

DiscordClient.maxConcurrency  :: number

discordShards

DiscordClient.discordShards  :: { Network.DiscordShard }

discordUser

DiscordClient.discordUser  :: Objects.DiscordUser?

discordApplication

DiscordClient.discordApplication  :: Objects.discordApplication

discordUser

DiscordClient.discordUser  :: DiscordUser

discordApplication

DiscordClient.discordApplication  :: DiscordApplication

Methods

connectAsync

DiscordClient : connectAsync ()  -> Vendor.Future

Connects the current DiscordClient to the Discord API.

local DiscordClient = DiscordLuau.DiscordClient.new(SettingsBuilder)
DiscordClient:connectAsync():after(function()
print("Connected to the Discord API!")
end)

fetchGuildAsync

DiscordClient : fetchGuildAsync (

     guildId: string
)  -> Vendor.Future<Objects.DiscordGuild>

Fetches a guild by its ID.

fetchChannelAsync

DiscordClient : fetchChannelAsync (

     channelId: string
)  -> Vendor.Future<Objects.DiscordChannel>

Fetches a channel by its ID.

fetchDMChannelAsync

DiscordClient : fetchDMChannelAsync (

     recipientId: string
)  -> Vendor.Future<Objects.DiscordChannel>

Fetches a DM channel between a user and the client.

updatePresenceAsync

DiscordClient : updatePresenceAsync (

     discordPresence: Builders.PresenceBuilder
)  -> Vendor.Future<boolean>

Updates the client’s presence.

createGuildAsync

DiscordClient : createGuildAsync (

     guildBuilder: Builders.GuildBuilder
)  -> Vendor.Future<DiscordGuild>

Creates a Guild, owned by the application.

setVerbose

DiscordClient : setVerbose (

     verbose: boolean
)  -> ()

Sets the verbosity level for logging.

Functions

new

DiscordClient . new (

     discordSettings: Builders.SettingsBuilder
)  -> ()

Constructor function for the Discord Client, used to instantiate a Discord Client object.

local DiscordClient = DiscordLuau.DiscordClient.new(SettingsBuilder)
DiscordClient:connectAsync():after(function()
print("Connected to the Discord API!")
end)