/// <inheritdoc/> /// <exception cref="ObjectDisposedException">thrown if the instance is disposed</exception> public async Task SendVoiceUpdateAsync(ulong guildId, ulong?voiceChannelId, bool selfDeaf = false, bool selfMute = false) { var payload = new JObject(); var data = new VoiceStateUpdatePayload(guildId, voiceChannelId, selfMute, selfDeaf); payload.Add("op", 4); payload.Add("d", JObject.FromObject(data)); var message = JsonConvert.SerializeObject(payload, Formatting.None); await GetClient(guildId).GetWebSocketClient().SendMessageAsync(message).ConfigureAwait(false); }
/// <summary> /// Sends a voice channel state update asynchronously. /// </summary> /// <param name="guildId">the guild snowflake identifier</param> /// <param name="voiceChannelId"> /// the snowflake identifier of the voice channel to join (if <see langword="null"/> the /// client should disconnect from the voice channel). /// </param> /// <param name="selfDeaf">a value indicating whether the bot user should be self deafened</param> /// <param name="selfMute">a value indicating whether the bot user should be self muted</param> /// <returns>a task that represents the asynchronous operation</returns> public Task SendVoiceUpdateAsync(ulong guildId, ulong?voiceChannelId, bool selfDeaf = false, bool selfMute = false) { var payload = new JObject(); var data = new VoiceStateUpdatePayload(guildId, voiceChannelId, selfMute, selfDeaf); payload.Add("op", 4); payload.Add("d", JObject.FromObject(data)); var message = JsonConvert.SerializeObject(payload, Formatting.None); _client.GetWebSocketClient().SendMessage(message); return(Task.CompletedTask); }