DiscordClientSpec
public protocol DiscordClientSpec : DiscordVoiceManagerDelegate, DiscordShardManagerDelegate, DiscordUserActor
Protocol that abstracts a DiscordClient
-
Whether or not this client is connected.
Declaration
Swift
var connected: Bool -
The delegate for the client.
Declaration
Swift
var delegate: DiscordClientDelegate? -
The queue that callbacks are called on. In addition, any reads from any properties of DiscordClient should be made on this queue, as this is the queue where modifications on them are made.
Declaration
Swift
var handleQueue: DispatchQueue
-
Declaration
Swift
init(token: DiscordToken, delegate: DiscordClientDelegate, configuration: [DiscordClientOption])Parameters
tokenThe discord token of the user.
configurationAn array of DiscordClientOption that can be used to customize the client.
delegateThe delegate for this client.
-
Begins the connection to Discord. Once this is called, wait for a
connectevent before trying to interact with the client.Declaration
Swift
func connect() -
Disconnects from Discord. A
disconnectevent is fired when the client has successfully disconnected.Declaration
Swift
func disconnect() -
Joins a voice channel. A
voiceEngine.readyevent will be fired when the client has joined the channel.Declaration
Swift
func joinVoiceChannel(_ channelId: ChannelID)Parameters
channelIdThe snowflake of the voice channel you would like to join
-
Leaves the currently connected voice channel.
Declaration
Swift
func leaveVoiceChannel(onGuild guildId: GuildID)Parameters
onGuildThe snowflake of the guild whose voice channel you would like to leave.
-
Requests all users from Discord for the guild specified. Use this when you need to get all users on a large guild. Multiple
guildMembersChunkwill be fired.Declaration
Swift
func requestAllUsers(on guildId: GuildID)Parameters
onThe snowflake of the guild you wish to request all users.
-
Sets the user’s presence.
Declaration
Swift
func setPresence(_ presence: DiscordPresenceUpdate)Parameters
presenceThe new presence object
DiscordClientSpec Protocol Reference