diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
index 76ff9eb4f..87c313700 100644
--- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
+++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
@@ -771,6 +771,12 @@ namespace Discord
/// A guild user associated with the specified ; if the user is already in the guild.
Task AddGuildUserAsync(ulong userId, string accessToken, Action func = null, RequestOptions options = null);
///
+ /// Disconnects the user from its current voice channel
+ ///
+ /// The user to disconnect.
+ /// A task that represents the asynchronous operation for disconnecting a user.
+ Task DisconnectAsync(IGuildUser user);
+ ///
/// Gets a collection of all users in this guild.
///
///
@@ -951,6 +957,15 @@ namespace Discord
/// emote.
///
Task ModifyEmoteAsync(GuildEmote emote, Action func, RequestOptions options = null);
+
+ ///
+ /// Moves the user to the voice channel.
+ ///
+ /// The user to move.
+ /// the channel where the user gets moved to.
+ /// A task that represents the asynchronous operation for moving a user.
+ Task MoveAsync(IGuildUser user, IVoiceChannel targetChannel);
+
///
/// Deletes an existing from this guild.
///
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
index 3608c2d8b..d566afc81 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
@@ -962,7 +962,7 @@ namespace Discord.Rest
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Id})";
- //Emotes
+ #region Emotes
///
public Task> GetEmotesAsync(RequestOptions options = null)
=> GuildHelper.GetEmotesAsync(this, Discord, options);
@@ -976,11 +976,20 @@ namespace Discord.Rest
/// is .
public Task ModifyEmoteAsync(GuildEmote emote, Action func, RequestOptions options = null)
=> GuildHelper.ModifyEmoteAsync(this, Discord, emote.Id, func, options);
+ ///
+ /// Moves the user to the voice channel.
+ ///
+ /// The user to move.
+ /// the channel where the user gets moved to.
+ /// A task that represents the asynchronous operation for moving a user.
+ public Task MoveAsync(IGuildUser user, IVoiceChannel targetChannel)
+ => user.ModifyAsync(x => x.Channel = new Optional(targetChannel));
///
public Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null)
=> GuildHelper.DeleteEmoteAsync(this, Discord, emote.Id, options);
+ #endregion
- //Stickers
+ #region Stickers
///
/// Creates a new sticker in this guild.
///
@@ -1087,8 +1096,9 @@ namespace Discord.Rest
///
public Task DeleteStickerAsync(CustomSticker sticker, RequestOptions options = null)
=> sticker.DeleteAsync(options);
+ #endregion
- //IGuild
+ #region IGuild
///
bool IGuild.Available => Available;
///
@@ -1291,6 +1301,13 @@ namespace Discord.Rest
async Task IGuild.AddGuildUserAsync(ulong userId, string accessToken, Action func, RequestOptions options)
=> await AddGuildUserAsync(userId, accessToken, func, options);
+ ///
+ /// Disconnects the user from its current voice channel
+ ///
+ /// The user to disconnect.
+ /// A task that represents the asynchronous operation for disconnecting a user.
+ async Task IGuild.DisconnectAsync(IGuildUser user) => await user.ModifyAsync(x => x.Channel = new Optional());
+
///
async Task IGuild.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
{
@@ -1399,5 +1416,6 @@ namespace Discord.Rest
else
return null;
}
+ #endregion
}
}
diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
index 0c211f394..1cdefcdb7 100644
--- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
+++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
@@ -572,7 +572,7 @@ namespace Discord.WebSocket
_emotes = emotes.ToImmutable();
}
- //General
+ #region General
///
public Task DeleteAsync(RequestOptions options = null)
=> GuildHelper.DeleteAsync(this, Discord, options);
@@ -596,8 +596,9 @@ namespace Discord.WebSocket
///
public Task LeaveAsync(RequestOptions options = null)
=> GuildHelper.LeaveAsync(this, Discord, options);
+ #endregion
- //Bans
+ #region Bans
///
/// Gets a collection of all users banned in this guild.
///
@@ -645,8 +646,9 @@ namespace Discord.WebSocket
///
public Task RemoveBanAsync(ulong userId, RequestOptions options = null)
=> GuildHelper.RemoveBanAsync(this, Discord, userId, options);
+ #endregion
- //Channels
+ #region Channels
///
/// Gets a channel in this guild.
///
@@ -807,8 +809,9 @@ namespace Discord.WebSocket
_channels.Clear();
}
+ #endregion
- //Voice Regions
+ #region Voice Regions
///
/// Gets a collection of all the voice regions this guild can access.
///
@@ -819,14 +822,16 @@ namespace Discord.WebSocket
///
public Task> GetVoiceRegionsAsync(RequestOptions options = null)
=> GuildHelper.GetVoiceRegionsAsync(this, Discord, options);
+ #endregion
- //Integrations
+ #region Integrations
public Task> GetIntegrationsAsync(RequestOptions options = null)
=> GuildHelper.GetIntegrationsAsync(this, Discord, options);
public Task CreateIntegrationAsync(ulong id, string type, RequestOptions options = null)
=> GuildHelper.CreateIntegrationAsync(this, Discord, id, type, options);
+ #endregion
- //Interactions
+ #region Interactions
///
/// Deletes all application commands in the current guild.
///
@@ -932,8 +937,9 @@ namespace Discord.WebSocket
return entities.ToImmutableArray();
}
+ #endregion
- //Invites
+ #region Invites
///
/// Gets a collection of all invites in this guild.
///
@@ -1040,8 +1046,9 @@ namespace Discord.WebSocket
return sticker;
return null;
}
+ #endregion
- //Users
+ #region Users
///
public Task AddGuildUserAsync(ulong id, string accessToken, Action func = null, RequestOptions options = null)
=> GuildHelper.AddGuildUserAsync(this, Discord, id, accessToken, func, options);
@@ -1240,7 +1247,24 @@ namespace Discord.WebSocket
public Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null)
=> GuildHelper.DeleteEmoteAsync(this, Discord, emote.Id, options);
- //Stickers
+ ///
+ /// Moves the user to the voice channel.
+ ///
+ /// The user to move.
+ /// the channel where the user gets moved to.
+ /// A task that represents the asynchronous operation for moving a user.
+ public Task MoveAsync(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.
+ async Task IGuild.DisconnectAsync(IGuildUser user) => await user.ModifyAsync(x => x.Channel = new Optional());
+ #endregion
+
+ #region Stickers
///
/// Gets a specific sticker within this guild.
///
@@ -1368,8 +1392,9 @@ namespace Discord.WebSocket
///
public Task DeleteStickerAsync(SocketCustomSticker sticker, RequestOptions options = null)
=> sticker.DeleteAsync(options);
+ #endregion
- //Voice States
+ #region Voice States
internal async Task AddOrUpdateVoiceStateAsync(ClientState state, VoiceStateModel model)
{
var voiceChannel = state.GetChannel(model.ChannelId.Value) as SocketVoiceChannel;
@@ -1413,8 +1438,9 @@ namespace Discord.WebSocket
}
return null;
}
+ #endregion
- //Audio
+ #region Audio
internal AudioInStream GetAudioStream(ulong userId)
{
return _audioClient?.GetInputStream(userId);
@@ -1568,8 +1594,9 @@ namespace Discord.WebSocket
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Id})";
internal SocketGuild Clone() => MemberwiseClone() as SocketGuild;
+ #endregion
- //IGuild
+ #region IGuild
///
ulong? IGuild.AFKChannelId => AFKChannelId;
///
@@ -1781,7 +1808,6 @@ namespace Discord.WebSocket
_audioLock?.Dispose();
_audioClient?.Dispose();
}
-
-
+ #endregion
}
}