@@ -572,7 +572,7 @@ namespace Discord.WebSocket
_emotes = emotes.ToImmutable();
_emotes = emotes.ToImmutable();
}
}
// General
#region General
/// <inheritdoc />
/// <inheritdoc />
public Task DeleteAsync(RequestOptions options = null)
public Task DeleteAsync(RequestOptions options = null)
=> GuildHelper.DeleteAsync(this, Discord, options);
=> GuildHelper.DeleteAsync(this, Discord, options);
@@ -596,8 +596,9 @@ namespace Discord.WebSocket
/// <inheritdoc />
/// <inheritdoc />
public Task LeaveAsync(RequestOptions options = null)
public Task LeaveAsync(RequestOptions options = null)
=> GuildHelper.LeaveAsync(this, Discord, options);
=> GuildHelper.LeaveAsync(this, Discord, options);
#endregion
// Bans
#region Bans
/// <summary>
/// <summary>
/// Gets a collection of all users banned in this guild.
/// Gets a collection of all users banned in this guild.
/// </summary>
/// </summary>
@@ -645,8 +646,9 @@ namespace Discord.WebSocket
/// <inheritdoc />
/// <inheritdoc />
public Task RemoveBanAsync(ulong userId, RequestOptions options = null)
public Task RemoveBanAsync(ulong userId, RequestOptions options = null)
=> GuildHelper.RemoveBanAsync(this, Discord, userId, options);
=> GuildHelper.RemoveBanAsync(this, Discord, userId, options);
#endregion
// Channels
#region Channels
/// <summary>
/// <summary>
/// Gets a channel in this guild.
/// Gets a channel in this guild.
/// </summary>
/// </summary>
@@ -807,8 +809,9 @@ namespace Discord.WebSocket
_channels.Clear();
_channels.Clear();
}
}
#endregion
// Voice Regions
#region Voice Regions
/// <summary>
/// <summary>
/// Gets a collection of all the voice regions this guild can access.
/// Gets a collection of all the voice regions this guild can access.
/// </summary>
/// </summary>
@@ -819,14 +822,16 @@ namespace Discord.WebSocket
/// </returns>
/// </returns>
public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)
public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)
=> GuildHelper.GetVoiceRegionsAsync(this, Discord, options);
=> GuildHelper.GetVoiceRegionsAsync(this, Discord, options);
#endregion
// Integrations
#region Integrations
public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null)
public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null)
=> GuildHelper.GetIntegrationsAsync(this, Discord, options);
=> GuildHelper.GetIntegrationsAsync(this, Discord, options);
public Task<RestGuildIntegration> CreateIntegrationAsync(ulong id, string type, RequestOptions options = null)
public Task<RestGuildIntegration> CreateIntegrationAsync(ulong id, string type, RequestOptions options = null)
=> GuildHelper.CreateIntegrationAsync(this, Discord, id, type, options);
=> GuildHelper.CreateIntegrationAsync(this, Discord, id, type, options);
#endregion
// Interactions
#region Interactions
/// <summary>
/// <summary>
/// Deletes all application commands in the current guild.
/// Deletes all application commands in the current guild.
/// </summary>
/// </summary>
@@ -932,8 +937,9 @@ namespace Discord.WebSocket
return entities.ToImmutableArray();
return entities.ToImmutableArray();
}
}
#endregion
// Invites
#region Invites
/// <summary>
/// <summary>
/// Gets a collection of all invites in this guild.
/// Gets a collection of all invites in this guild.
/// </summary>
/// </summary>
@@ -1040,8 +1046,9 @@ namespace Discord.WebSocket
return sticker;
return sticker;
return null;
return null;
}
}
#endregion
// Users
#region Users
/// <inheritdoc />
/// <inheritdoc />
public Task<RestGuildUser> AddGuildUserAsync(ulong id, string accessToken, Action<AddGuildUserProperties> func = null, RequestOptions options = null)
public Task<RestGuildUser> AddGuildUserAsync(ulong id, string accessToken, Action<AddGuildUserProperties> func = null, RequestOptions options = null)
=> GuildHelper.AddGuildUserAsync(this, Discord, id, accessToken, func, options);
=> GuildHelper.AddGuildUserAsync(this, Discord, id, accessToken, func, options);
@@ -1240,7 +1247,24 @@ namespace Discord.WebSocket
public Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null)
public Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null)
=> GuildHelper.DeleteEmoteAsync(this, Discord, emote.Id, options);
=> GuildHelper.DeleteEmoteAsync(this, Discord, emote.Id, options);
//Stickers
/// <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 Task MoveAsync(IGuildUser user, IVoiceChannel targetChannel)
=> user.ModifyAsync(x => x.Channel = new Optional<IVoiceChannel>(targetChannel));
/// <summary>
/// Disconnects the user from its current voice channel
/// </summary>
/// <param name="user">The user to disconnect.</param>
/// <returns>A task that represents the asynchronous operation for disconnecting a user.</returns>
async Task IGuild.DisconnectAsync(IGuildUser user) => await user.ModifyAsync(x => x.Channel = new Optional<IVoiceChannel>());
#endregion
#region Stickers
/// <summary>
/// <summary>
/// Gets a specific sticker within this guild.
/// Gets a specific sticker within this guild.
/// </summary>
/// </summary>
@@ -1368,8 +1392,9 @@ namespace Discord.WebSocket
/// </returns>
/// </returns>
public Task DeleteStickerAsync(SocketCustomSticker sticker, RequestOptions options = null)
public Task DeleteStickerAsync(SocketCustomSticker sticker, RequestOptions options = null)
=> sticker.DeleteAsync(options);
=> sticker.DeleteAsync(options);
#endregion
// Voice States
#region Voice States
internal async Task<SocketVoiceState> AddOrUpdateVoiceStateAsync(ClientState state, VoiceStateModel model)
internal async Task<SocketVoiceState> AddOrUpdateVoiceStateAsync(ClientState state, VoiceStateModel model)
{
{
var voiceChannel = state.GetChannel(model.ChannelId.Value) as SocketVoiceChannel;
var voiceChannel = state.GetChannel(model.ChannelId.Value) as SocketVoiceChannel;
@@ -1413,8 +1438,9 @@ namespace Discord.WebSocket
}
}
return null;
return null;
}
}
#endregion
// Audio
#region Audio
internal AudioInStream GetAudioStream(ulong userId)
internal AudioInStream GetAudioStream(ulong userId)
{
{
return _audioClient?.GetInputStream(userId);
return _audioClient?.GetInputStream(userId);
@@ -1568,8 +1594,9 @@ namespace Discord.WebSocket
public override string ToString() => Name;
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Id})";
private string DebuggerDisplay => $"{Name} ({Id})";
internal SocketGuild Clone() => MemberwiseClone() as SocketGuild;
internal SocketGuild Clone() => MemberwiseClone() as SocketGuild;
#endregion
// IGuild
#region IGuild
/// <inheritdoc />
/// <inheritdoc />
ulong? IGuild.AFKChannelId => AFKChannelId;
ulong? IGuild.AFKChannelId => AFKChannelId;
/// <inheritdoc />
/// <inheritdoc />
@@ -1781,7 +1808,6 @@ namespace Discord.WebSocket
_audioLock?.Dispose();
_audioLock?.Dispose();
_audioClient?.Dispose();
_audioClient?.Dispose();
}
}
#endregion
}
}
}
}