Browse Source

feature: Add MoveAsync to IGuildUser in UserExtensions

pull/1921/head
Yannik Höflich 3 years ago
parent
commit
e63680a682
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      src/Discord.Net.Core/Extensions/UserExtensions.cs

+ 9
- 0
src/Discord.Net.Core/Extensions/UserExtensions.cs View File

@@ -165,5 +165,14 @@ namespace Discord
/// </returns>
public static Task BanAsync(this IGuildUser user, int pruneDays = 0, string reason = null, RequestOptions options = null)
=> user.Guild.AddBanAsync(user, pruneDays, reason, options);


/// <summary>
/// Moves the user to the voice channel.
/// </summary>
/// <param name="user">The user to move.</param>
/// <param name="targetChannel">the channel where the user gets moved to.</param>
/// <returns>A task that represents the asynchronous operation for moving a user.</returns>
public static Task MoveAsync(this IGuildUser user, IVoiceChannel targetChannel) => user.ModifyAsync(x => x.Channel = new Optional<IVoiceChannel>(targetChannel));
}
}

Loading…
Cancel
Save