From ccfd8f85dff3a696d98c69bce2d8b030b5da1056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannik=20H=C3=B6flich?= Date: Mon, 13 Sep 2021 18:29:06 +0200 Subject: [PATCH] feature: Add DisconnectAsync to IGuildUser in UserExtensions --- src/Discord.Net.Core/Extensions/UserExtensions.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.Core/Extensions/UserExtensions.cs b/src/Discord.Net.Core/Extensions/UserExtensions.cs index 95a18daf6..04eb78714 100644 --- a/src/Discord.Net.Core/Extensions/UserExtensions.cs +++ b/src/Discord.Net.Core/Extensions/UserExtensions.cs @@ -173,6 +173,16 @@ namespace Discord /// The user to move. /// the channel where the user gets moved to. /// A task that represents the asynchronous operation for moving a user. - public static Task MoveAsync(this IGuildUser user, IVoiceChannel targetChannel) => user.ModifyAsync(x => x.Channel = new Optional(targetChannel)); + public static Task MoveAsync(this IGuildUser user, IVoiceChannel targetChannel) + => user.ModifyAsync(x => x.Channel = new Optional(targetChannel)); + + + /// + /// Disconnects the user from its current voice channel + /// + /// The user to disconnect. + /// A task that represents the asynchronous operation for disconnecting a user. + public static Task DisconnectAsync(this IGuildUser user) + => user.ModifyAsync(x => x.Channel = new Optional()); } }