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
token
The discord token of the user.
configuration
An array of DiscordClientOption that can be used to customize the client.
delegate
The delegate for this client.
-
Begins the connection to Discord. Once this is called, wait for a
connect
event before trying to interact with the client.Declaration
Swift
func connect()
-
Disconnects from Discord. A
disconnect
event is fired when the client has successfully disconnected.Declaration
Swift
func disconnect()
-
Joins a voice channel. A
voiceEngine.ready
event will be fired when the client has joined the channel.Declaration
Swift
func joinVoiceChannel(_ channelId: ChannelID)
Parameters
channelId
The snowflake of the voice channel you would like to join
-
Leaves the currently connected voice channel.
Declaration
Swift
func leaveVoiceChannel(onGuild guildId: GuildID)
Parameters
onGuild
The 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
guildMembersChunk
will be fired.Declaration
Swift
func requestAllUsers(on guildId: GuildID)
Parameters
on
The snowflake of the guild you wish to request all users.
-
Sets the user’s presence.
Declaration
Swift
func setPresence(_ presence: DiscordPresenceUpdate)
Parameters
presence
The new presence object