| @@ -1,6 +1,6 @@ | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| public class ModifyGuildChannelsParams | |||||
| public class BulkGuildChannelProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// The id of the channel to apply this position to. | /// The id of the channel to apply this position to. | ||||
| @@ -11,7 +11,7 @@ | |||||
| /// </summary> | /// </summary> | ||||
| public int Position { get; set; } | public int Position { get; set; } | ||||
| public ModifyGuildChannelsParams(ulong id, int position) | |||||
| public BulkGuildChannelProperties(ulong id, int position) | |||||
| { | { | ||||
| Id = id; | Id = id; | ||||
| Position = position; | Position = position; | ||||
| @@ -11,7 +11,7 @@ | |||||
| /// }); | /// }); | ||||
| /// </code> | /// </code> | ||||
| /// </example> | /// </example> | ||||
| public class ModifyGuildChannelParams | |||||
| public class GuildChannelProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// Set the channel to this name | /// Set the channel to this name | ||||
| @@ -26,7 +26,7 @@ namespace Discord | |||||
| Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null); | Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null); | ||||
| /// <summary> Modifies this guild channel. </summary> | /// <summary> Modifies this guild channel. </summary> | ||||
| Task ModifyAsync(Action<ModifyGuildChannelParams> func, RequestOptions options = null); | |||||
| Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null); | |||||
| /// <summary> Gets the permission overwrite for a specific role, or null if one does not exist. </summary> | /// <summary> Gets the permission overwrite for a specific role, or null if one does not exist. </summary> | ||||
| OverwritePermissions? GetPermissionOverwrite(IRole role); | OverwritePermissions? GetPermissionOverwrite(IRole role); | ||||
| @@ -10,6 +10,6 @@ namespace Discord | |||||
| string Topic { get; } | string Topic { get; } | ||||
| /// <summary> Modifies this text channel. </summary> | /// <summary> Modifies this text channel. </summary> | ||||
| Task ModifyAsync(Action<ModifyTextChannelParams> func, RequestOptions options = null); | |||||
| Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null); | |||||
| } | } | ||||
| } | } | ||||
| @@ -13,7 +13,7 @@ namespace Discord | |||||
| int UserLimit { get; } | int UserLimit { get; } | ||||
| /// <summary> Modifies this voice channel. </summary> | /// <summary> Modifies this voice channel. </summary> | ||||
| Task ModifyAsync(Action<ModifyVoiceChannelParams> func, RequestOptions options = null); | |||||
| Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null); | |||||
| /// <summary> Connects to this voice channel. </summary> | /// <summary> Connects to this voice channel. </summary> | ||||
| Task<IAudioClient> ConnectAsync(); | Task<IAudioClient> ConnectAsync(); | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public class ModifyTextChannelParams : ModifyGuildChannelParams | |||||
| public class TextChannelProperties : GuildChannelProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// What the topic of the channel should be set to. | /// What the topic of the channel should be set to. | ||||
| @@ -1,7 +1,7 @@ | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public class ModifyVoiceChannelParams : ModifyGuildChannelParams | |||||
| public class VoiceChannelProperties : GuildChannelProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// The bitrate of the voice connections in this channel. Must be greater than 8000 | /// The bitrate of the voice connections in this channel. Must be greater than 8000 | ||||
| @@ -3,7 +3,7 @@ | |||||
| /// <summary> | /// <summary> | ||||
| /// Modify the widget of an IGuild with the specified parameters | /// Modify the widget of an IGuild with the specified parameters | ||||
| /// </summary> | /// </summary> | ||||
| public class ModifyGuildEmbedParams | |||||
| public class GuildEmbedProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// Should the widget be enabled? | /// Should the widget be enabled? | ||||
| @@ -1,6 +1,6 @@ | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| public class ModifyGuildIntegrationParams | |||||
| public class GuildIntegrationProperties | |||||
| { | { | ||||
| public Optional<int> ExpireBehavior { get; set; } | public Optional<int> ExpireBehavior { get; set; } | ||||
| public Optional<int> ExpireGracePeriod { get; set; } | public Optional<int> ExpireGracePeriod { get; set; } | ||||
| @@ -13,7 +13,7 @@ | |||||
| /// </code> | /// </code> | ||||
| /// </example> | /// </example> | ||||
| /// <see cref="IGuild"/> | /// <see cref="IGuild"/> | ||||
| public class ModifyGuildParams | |||||
| public class GuildProperties | |||||
| { | { | ||||
| public Optional<string> Username { get; set; } | public Optional<string> Username { get; set; } | ||||
| /// <summary> | /// <summary> | ||||
| @@ -53,13 +53,13 @@ namespace Discord | |||||
| IReadOnlyCollection<IRole> Roles { get; } | IReadOnlyCollection<IRole> Roles { get; } | ||||
| /// <summary> Modifies this guild. </summary> | /// <summary> Modifies this guild. </summary> | ||||
| Task ModifyAsync(Action<ModifyGuildParams> func, RequestOptions options = null); | |||||
| Task ModifyAsync(Action<GuildProperties> func, RequestOptions options = null); | |||||
| /// <summary> Modifies this guild's embed. </summary> | /// <summary> Modifies this guild's embed. </summary> | ||||
| Task ModifyEmbedAsync(Action<ModifyGuildEmbedParams> func, RequestOptions options = null); | |||||
| Task ModifyEmbedAsync(Action<GuildEmbedProperties> func, RequestOptions options = null); | |||||
| /// <summary> Bulk modifies the channels of this guild. </summary> | /// <summary> Bulk modifies the channels of this guild. </summary> | ||||
| Task ModifyChannelsAsync(IEnumerable<ModifyGuildChannelsParams> args, RequestOptions options = null); | |||||
| Task ModifyChannelsAsync(IEnumerable<BulkGuildChannelProperties> args, RequestOptions options = null); | |||||
| /// <summary> Bulk modifies the roles of this guild. </summary> | /// <summary> Bulk modifies the roles of this guild. </summary> | ||||
| Task ModifyRolesAsync(IEnumerable<ModifyGuildRolesParams> args, RequestOptions options = null); | |||||
| Task ModifyRolesAsync(IEnumerable<BulkRoleProperties> args, RequestOptions options = null); | |||||
| /// <summary> Leaves this guild. If you are the owner, use Delete instead. </summary> | /// <summary> Leaves this guild. If you are the owner, use Delete instead. </summary> | ||||
| Task LeaveAsync(RequestOptions options = null); | Task LeaveAsync(RequestOptions options = null); | ||||
| @@ -7,7 +7,7 @@ namespace Discord | |||||
| public interface IUserMessage : IMessage | public interface IUserMessage : IMessage | ||||
| { | { | ||||
| /// <summary> Modifies this message. </summary> | /// <summary> Modifies this message. </summary> | ||||
| Task ModifyAsync(Action<ModifyMessageParams> func, RequestOptions options = null); | |||||
| Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null); | |||||
| /// <summary> Adds this message to its channel's pinned messages. </summary> | /// <summary> Adds this message to its channel's pinned messages. </summary> | ||||
| Task PinAsync(RequestOptions options = null); | Task PinAsync(RequestOptions options = null); | ||||
| /// <summary> Removes this message from its channel's pinned messages. </summary> | /// <summary> Removes this message from its channel's pinned messages. </summary> | ||||
| @@ -20,7 +20,7 @@ | |||||
| /// }); | /// }); | ||||
| /// </code> | /// </code> | ||||
| /// </example> | /// </example> | ||||
| public class ModifyMessageParams | |||||
| public class MessageProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// The content of the message | /// The content of the message | ||||
| @@ -1,13 +1,13 @@ | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| public class ModifyGuildRolesParams : ModifyGuildRoleParams | |||||
| public class BulkRoleProperties : RoleProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// The id of the role to be edited | /// The id of the role to be edited | ||||
| /// </summary> | /// </summary> | ||||
| public ulong Id { get; } | public ulong Id { get; } | ||||
| public ModifyGuildRolesParams(ulong id) | |||||
| public BulkRoleProperties(ulong id) | |||||
| { | { | ||||
| Id = id; | Id = id; | ||||
| } | } | ||||
| @@ -25,6 +25,6 @@ namespace Discord | |||||
| int Position { get; } | int Position { get; } | ||||
| ///// <summary> Modifies this role. </summary> | ///// <summary> Modifies this role. </summary> | ||||
| Task ModifyAsync(Action<ModifyGuildRoleParams> func, RequestOptions options = null); | |||||
| Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null); | |||||
| } | } | ||||
| } | } | ||||
| @@ -13,7 +13,7 @@ | |||||
| /// </code> | /// </code> | ||||
| /// </example> | /// </example> | ||||
| /// <seealso cref="IRole"/> | /// <seealso cref="IRole"/> | ||||
| public class ModifyGuildRoleParams | |||||
| public class RoleProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// The name of the role | /// The name of the role | ||||
| @@ -14,7 +14,7 @@ namespace Discord | |||||
| /// </code> | /// </code> | ||||
| /// </example> | /// </example> | ||||
| /// <seealso cref="IGuildUser"/> | /// <seealso cref="IGuildUser"/> | ||||
| public class ModifyGuildMemberParams | |||||
| public class GuildUserProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// Should the user be guild-muted in a voice channel? | /// Should the user be guild-muted in a voice channel? | ||||
| @@ -60,5 +60,12 @@ namespace Discord | |||||
| /// This user MUST already be in a Voice Channel for this to work. | /// This user MUST already be in a Voice Channel for this to work. | ||||
| /// </remarks> | /// </remarks> | ||||
| public Optional<IVoiceChannel> Channel { get; set; } | public Optional<IVoiceChannel> Channel { get; set; } | ||||
| /// <summary> | |||||
| /// Move a user to a voice channel. | |||||
| /// </summary> | |||||
| /// <remarks> | |||||
| /// This user MUST already be in a Voice Channel for this to work. | |||||
| /// </remarks> | |||||
| public Optional<ulong> ChannelId { get; set; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -28,6 +28,6 @@ namespace Discord | |||||
| /// <summary> Kicks this user from this guild. </summary> | /// <summary> Kicks this user from this guild. </summary> | ||||
| Task KickAsync(RequestOptions options = null); | Task KickAsync(RequestOptions options = null); | ||||
| /// <summary> Modifies this user's properties in this guild. </summary> | /// <summary> Modifies this user's properties in this guild. </summary> | ||||
| Task ModifyAsync(Action<ModifyGuildMemberParams> func, RequestOptions options = null); | |||||
| Task ModifyAsync(Action<GuildUserProperties> func, RequestOptions options = null); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,4 +1,3 @@ | |||||
| using Discord.API.Rest; | |||||
| using System; | using System; | ||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
| @@ -13,6 +12,6 @@ namespace Discord | |||||
| /// <summary> Returns true if this user has enabled MFA on their account. </summary> | /// <summary> Returns true if this user has enabled MFA on their account. </summary> | ||||
| bool IsMfaEnabled { get; } | bool IsMfaEnabled { get; } | ||||
| Task ModifyAsync(Action<ModifyCurrentUserParams> func, RequestOptions options = null); | |||||
| Task ModifyAsync(Action<SelfUserProperties> func, RequestOptions options = null); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,12 +0,0 @@ | |||||
| namespace Discord | |||||
| { | |||||
| public class ModifyCurrentUserNickParams | |||||
| { | |||||
| public string Nickname { get; } | |||||
| public ModifyCurrentUserNickParams(string nickname) | |||||
| { | |||||
| Nickname = nickname; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -12,7 +12,7 @@ | |||||
| /// </code> | /// </code> | ||||
| /// </example> | /// </example> | ||||
| /// <seealso cref="ISelfUser"/> | /// <seealso cref="ISelfUser"/> | ||||
| public class ModifyCurrentUserParams | |||||
| public class SelfUserProperties | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// Your username | /// Your username | ||||
| @@ -19,10 +19,10 @@ namespace Discord.Rest | |||||
| await client.ApiClient.DeleteChannelAsync(channel.Id, options).ConfigureAwait(false); | await client.ApiClient.DeleteChannelAsync(channel.Id, options).ConfigureAwait(false); | ||||
| } | } | ||||
| public static async Task<Model> ModifyAsync(IGuildChannel channel, BaseDiscordClient client, | public static async Task<Model> ModifyAsync(IGuildChannel channel, BaseDiscordClient client, | ||||
| Action<ModifyGuildChannelParams> func, | |||||
| Action<GuildChannelProperties> func, | |||||
| RequestOptions options) | RequestOptions options) | ||||
| { | { | ||||
| var args = new ModifyGuildChannelParams(); | |||||
| var args = new GuildChannelProperties(); | |||||
| func(args); | func(args); | ||||
| var apiArgs = new API.Rest.ModifyGuildChannelParams | var apiArgs = new API.Rest.ModifyGuildChannelParams | ||||
| { | { | ||||
| @@ -54,7 +54,7 @@ namespace Discord.Rest | |||||
| var model = await Discord.ApiClient.GetChannelAsync(GuildId, Id, options).ConfigureAwait(false); | var model = await Discord.ApiClient.GetChannelAsync(GuildId, Id, options).ConfigureAwait(false); | ||||
| Update(model); | Update(model); | ||||
| } | } | ||||
| public async Task ModifyAsync(Action<ModifyGuildChannelParams> func, RequestOptions options = null) | |||||
| public async Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null) | |||||
| { | { | ||||
| var model = await ChannelHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | var model = await ChannelHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | ||||
| Update(model); | Update(model); | ||||
| @@ -15,11 +15,11 @@ namespace Discord.Rest | |||||
| { | { | ||||
| //General | //General | ||||
| public static async Task<Model> ModifyAsync(IGuild guild, BaseDiscordClient client, | public static async Task<Model> ModifyAsync(IGuild guild, BaseDiscordClient client, | ||||
| Action<ModifyGuildParams> func, RequestOptions options) | |||||
| Action<GuildProperties> func, RequestOptions options) | |||||
| { | { | ||||
| if (func == null) throw new NullReferenceException(nameof(func)); | if (func == null) throw new NullReferenceException(nameof(func)); | ||||
| var args = new ModifyGuildParams(); | |||||
| var args = new GuildProperties(); | |||||
| func(args); | func(args); | ||||
| var apiArgs = new API.Rest.ModifyGuildParams | var apiArgs = new API.Rest.ModifyGuildParams | ||||
| @@ -57,11 +57,11 @@ namespace Discord.Rest | |||||
| return await client.ApiClient.ModifyGuildAsync(guild.Id, apiArgs, options).ConfigureAwait(false); | return await client.ApiClient.ModifyGuildAsync(guild.Id, apiArgs, options).ConfigureAwait(false); | ||||
| } | } | ||||
| public static async Task<EmbedModel> ModifyEmbedAsync(IGuild guild, BaseDiscordClient client, | public static async Task<EmbedModel> ModifyEmbedAsync(IGuild guild, BaseDiscordClient client, | ||||
| Action<ModifyGuildEmbedParams> func, RequestOptions options) | |||||
| Action<GuildEmbedProperties> func, RequestOptions options) | |||||
| { | { | ||||
| if (func == null) throw new NullReferenceException(nameof(func)); | if (func == null) throw new NullReferenceException(nameof(func)); | ||||
| var args = new ModifyGuildEmbedParams(); | |||||
| var args = new GuildEmbedProperties(); | |||||
| func(args); | func(args); | ||||
| var apiArgs = new API.Rest.ModifyGuildEmbedParams | var apiArgs = new API.Rest.ModifyGuildEmbedParams | ||||
| { | { | ||||
| @@ -76,13 +76,13 @@ namespace Discord.Rest | |||||
| return await client.ApiClient.ModifyGuildEmbedAsync(guild.Id, apiArgs, options).ConfigureAwait(false); | return await client.ApiClient.ModifyGuildEmbedAsync(guild.Id, apiArgs, options).ConfigureAwait(false); | ||||
| } | } | ||||
| public static async Task ModifyChannelsAsync(IGuild guild, BaseDiscordClient client, | public static async Task ModifyChannelsAsync(IGuild guild, BaseDiscordClient client, | ||||
| IEnumerable<GuildChannelsProperties> args, RequestOptions options) | |||||
| IEnumerable<BulkGuildChannelProperties> args, RequestOptions options) | |||||
| { | { | ||||
| var apiArgs = args.Select(x => new API.Rest.ModifyGuildChannelsParams(x.Id, x.Position)); | var apiArgs = args.Select(x => new API.Rest.ModifyGuildChannelsParams(x.Id, x.Position)); | ||||
| await client.ApiClient.ModifyGuildChannelsAsync(guild.Id, apiArgs, options).ConfigureAwait(false); | await client.ApiClient.ModifyGuildChannelsAsync(guild.Id, apiArgs, options).ConfigureAwait(false); | ||||
| } | } | ||||
| public static async Task<IReadOnlyCollection<RoleModel>> ModifyRolesAsync(IGuild guild, BaseDiscordClient client, | public static async Task<IReadOnlyCollection<RoleModel>> ModifyRolesAsync(IGuild guild, BaseDiscordClient client, | ||||
| IEnumerable<ModifyGuildRolesParams> args, RequestOptions options) | |||||
| IEnumerable<BulkRoleProperties> args, RequestOptions options) | |||||
| { | { | ||||
| var apiArgs = args.Select(x => new API.Rest.ModifyGuildRolesParams(x.Id) | var apiArgs = args.Select(x => new API.Rest.ModifyGuildRolesParams(x.Id) | ||||
| { | { | ||||
| @@ -105,22 +105,22 @@ namespace Discord.Rest | |||||
| public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
| => GuildHelper.DeleteAsync(this, Discord, options); | => GuildHelper.DeleteAsync(this, Discord, options); | ||||
| public async Task ModifyAsync(Action<ModifyGuildParams> func, RequestOptions options = null) | |||||
| public async Task ModifyAsync(Action<GuildProperties> func, RequestOptions options = null) | |||||
| { | { | ||||
| var model = await GuildHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | var model = await GuildHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | ||||
| Update(model); | Update(model); | ||||
| } | } | ||||
| public async Task ModifyEmbedAsync(Action<ModifyGuildEmbedParams> func, RequestOptions options = null) | |||||
| public async Task ModifyEmbedAsync(Action<GuildEmbedProperties> func, RequestOptions options = null) | |||||
| { | { | ||||
| var model = await GuildHelper.ModifyEmbedAsync(this, Discord, func, options).ConfigureAwait(false); | var model = await GuildHelper.ModifyEmbedAsync(this, Discord, func, options).ConfigureAwait(false); | ||||
| Update(model); | Update(model); | ||||
| } | } | ||||
| public async Task ModifyChannelsAsync(IEnumerable<GuildChannelsProperties> args, RequestOptions options = null) | |||||
| public async Task ModifyChannelsAsync(IEnumerable<BulkGuildChannelProperties> args, RequestOptions options = null) | |||||
| { | { | ||||
| var arr = args.ToArray(); | var arr = args.ToArray(); | ||||
| await GuildHelper.ModifyChannelsAsync(this, Discord, arr, options); | await GuildHelper.ModifyChannelsAsync(this, Discord, arr, options); | ||||
| } | } | ||||
| public async Task ModifyRolesAsync(IEnumerable<ModifyGuildRolesParams> args, RequestOptions options = null) | |||||
| public async Task ModifyRolesAsync(IEnumerable<BulkRoleProperties> args, RequestOptions options = null) | |||||
| { | { | ||||
| var models = await GuildHelper.ModifyRolesAsync(this, Discord, args, options).ConfigureAwait(false); | var models = await GuildHelper.ModifyRolesAsync(this, Discord, args, options).ConfigureAwait(false); | ||||
| foreach (var model in models) | foreach (var model in models) | ||||
| @@ -55,11 +55,11 @@ namespace Discord.Rest | |||||
| { | { | ||||
| await Discord.ApiClient.DeleteGuildIntegrationAsync(GuildId, Id).ConfigureAwait(false); | await Discord.ApiClient.DeleteGuildIntegrationAsync(GuildId, Id).ConfigureAwait(false); | ||||
| } | } | ||||
| public async Task ModifyAsync(Action<ModifyGuildIntegrationParams> func) | |||||
| public async Task ModifyAsync(Action<GuildIntegrationProperties> func) | |||||
| { | { | ||||
| if (func == null) throw new NullReferenceException(nameof(func)); | if (func == null) throw new NullReferenceException(nameof(func)); | ||||
| var args = new ModifyGuildIntegrationParams(); | |||||
| var args = new GuildIntegrationProperties(); | |||||
| func(args); | func(args); | ||||
| var apiArgs = new API.Rest.ModifyGuildIntegrationParams | var apiArgs = new API.Rest.ModifyGuildIntegrationParams | ||||
| { | { | ||||
| @@ -10,10 +10,10 @@ namespace Discord.Rest | |||||
| { | { | ||||
| internal static class MessageHelper | internal static class MessageHelper | ||||
| { | { | ||||
| public static async Task<Model> ModifyAsync(IMessage msg, BaseDiscordClient client, Action<ModifyMessageParams> func, | |||||
| public static async Task<Model> ModifyAsync(IMessage msg, BaseDiscordClient client, Action<MessageProperties> func, | |||||
| RequestOptions options) | RequestOptions options) | ||||
| { | { | ||||
| var args = new ModifyMessageParams(); | |||||
| var args = new MessageProperties(); | |||||
| func(args); | func(args); | ||||
| var apiArgs = new API.Rest.ModifyMessageParams | var apiArgs = new API.Rest.ModifyMessageParams | ||||
| { | { | ||||
| @@ -126,7 +126,7 @@ namespace Discord.Rest | |||||
| } | } | ||||
| } | } | ||||
| public async Task ModifyAsync(Action<ModifyMessageParams> func, RequestOptions options) | |||||
| public async Task ModifyAsync(Action<MessageProperties> func, RequestOptions options) | |||||
| { | { | ||||
| var model = await MessageHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | var model = await MessageHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | ||||
| Update(model); | Update(model); | ||||
| @@ -44,7 +44,7 @@ namespace Discord.Rest | |||||
| Permissions = new GuildPermissions(model.Permissions); | Permissions = new GuildPermissions(model.Permissions); | ||||
| } | } | ||||
| public async Task ModifyAsync(Action<ModifyGuildRoleParams> func, RequestOptions options = null) | |||||
| public async Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null) | |||||
| { | { | ||||
| var model = await RoleHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | var model = await RoleHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | ||||
| Update(model); | Update(model); | ||||
| @@ -14,9 +14,9 @@ namespace Discord.Rest | |||||
| await client.ApiClient.DeleteGuildRoleAsync(role.Guild.Id, role.Id, options).ConfigureAwait(false); | await client.ApiClient.DeleteGuildRoleAsync(role.Guild.Id, role.Id, options).ConfigureAwait(false); | ||||
| } | } | ||||
| public static async Task<Model> ModifyAsync(IRole role, BaseDiscordClient client, | public static async Task<Model> ModifyAsync(IRole role, BaseDiscordClient client, | ||||
| Action<ModifyGuildRoleParams> func, RequestOptions options) | |||||
| Action<RoleProperties> func, RequestOptions options) | |||||
| { | { | ||||
| var args = new ModifyGuildRoleParams(); | |||||
| var args = new RoleProperties(); | |||||
| func(args); | func(args); | ||||
| var apiArgs = new API.Rest.ModifyGuildRoleParams | var apiArgs = new API.Rest.ModifyGuildRoleParams | ||||
| { | { | ||||
| @@ -68,7 +68,7 @@ namespace Discord.Rest | |||||
| var model = await Discord.ApiClient.GetGuildMemberAsync(GuildId, Id, options).ConfigureAwait(false); | var model = await Discord.ApiClient.GetGuildMemberAsync(GuildId, Id, options).ConfigureAwait(false); | ||||
| Update(model); | Update(model); | ||||
| } | } | ||||
| public async Task ModifyAsync(Action<ModifyGuildMemberParams> func, RequestOptions options = null) | |||||
| public async Task ModifyAsync(Action<GuildUserProperties> func, RequestOptions options = null) | |||||
| { | { | ||||
| var args = await UserHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | var args = await UserHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | ||||
| if (args.Deaf.IsSpecified) | if (args.Deaf.IsSpecified) | ||||
| @@ -43,7 +43,7 @@ namespace Discord.Rest | |||||
| Update(model); | Update(model); | ||||
| } | } | ||||
| public async Task ModifyAsync(Action<ModifyCurrentUserParams> func, RequestOptions options = null) | |||||
| public async Task ModifyAsync(Action<SelfUserProperties> func, RequestOptions options = null) | |||||
| { | { | ||||
| if (Id != Discord.CurrentUser.Id) | if (Id != Discord.CurrentUser.Id) | ||||
| throw new InvalidOperationException("Unable to modify this object using a different token."); | throw new InvalidOperationException("Unable to modify this object using a different token."); | ||||
| @@ -9,10 +9,10 @@ namespace Discord.Rest | |||||
| { | { | ||||
| internal static class UserHelper | internal static class UserHelper | ||||
| { | { | ||||
| public static async Task<Model> ModifyAsync(ISelfUser user, BaseDiscordClient client, Action<ModifyCurrentUserParams> func, | |||||
| public static async Task<Model> ModifyAsync(ISelfUser user, BaseDiscordClient client, Action<SelfUserProperties> func, | |||||
| RequestOptions options) | RequestOptions options) | ||||
| { | { | ||||
| var args = new ModifyCurrentUserParams(); | |||||
| var args = new SelfUserProperties(); | |||||
| func(args); | func(args); | ||||
| var apiArgs = new API.Rest.ModifyCurrentUserParams | var apiArgs = new API.Rest.ModifyCurrentUserParams | ||||
| { | { | ||||
| @@ -25,19 +25,23 @@ namespace Discord.Rest | |||||
| return await client.ApiClient.ModifySelfAsync(apiArgs, options).ConfigureAwait(false); | return await client.ApiClient.ModifySelfAsync(apiArgs, options).ConfigureAwait(false); | ||||
| } | } | ||||
| public static async Task<ModifyGuildMemberParams> ModifyAsync(IGuildUser user, BaseDiscordClient client, Action<ModifyGuildMemberParams> func, | |||||
| public static async Task<GuildUserProperties> ModifyAsync(IGuildUser user, BaseDiscordClient client, Action<GuildUserProperties> func, | |||||
| RequestOptions options) | RequestOptions options) | ||||
| { | { | ||||
| var args = new ModifyGuildMemberParams(); | |||||
| var args = new GuildUserProperties(); | |||||
| func(args); | func(args); | ||||
| var apiArgs = new API.Rest.ModifyGuildMemberParams | var apiArgs = new API.Rest.ModifyGuildMemberParams | ||||
| { | { | ||||
| ChannelId = args.Channel.IsSpecified ? args.Channel.Value.Id : Optional.Create<ulong>(), | |||||
| Deaf = args.Deaf, | Deaf = args.Deaf, | ||||
| Mute = args.Mute, | Mute = args.Mute, | ||||
| Nickname = args.Nickname | Nickname = args.Nickname | ||||
| }; | }; | ||||
| if (args.Channel.IsSpecified) | |||||
| apiArgs.ChannelId = args.Channel.Value.Id; | |||||
| else if (args.ChannelId.IsSpecified) | |||||
| apiArgs.ChannelId = args.ChannelId.Value; | |||||
| if (args.Roles.IsSpecified) | if (args.Roles.IsSpecified) | ||||
| apiArgs.RoleIds = args.Roles.Value.Select(x => x.Id).ToArray(); | apiArgs.RoleIds = args.Roles.Value.Select(x => x.Id).ToArray(); | ||||
| else if (args.RoleIds.IsSpecified) | else if (args.RoleIds.IsSpecified) | ||||
| @@ -36,7 +36,7 @@ namespace Discord.Rpc | |||||
| Position = model.Position.Value; | Position = model.Position.Value; | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyGuildChannelParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null) | |||||
| => ChannelHelper.ModifyAsync(this, Discord, func, options); | => ChannelHelper.ModifyAsync(this, Discord, func, options); | ||||
| public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
| => ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
| @@ -34,7 +34,7 @@ namespace Discord.Rpc | |||||
| CachedMessages = model.Messages.Select(x => RpcMessage.Create(Discord, Id, x)).ToImmutableArray(); | CachedMessages = model.Messages.Select(x => RpcMessage.Create(Discord, Id, x)).ToImmutableArray(); | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyTextChannelParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null) | |||||
| => ChannelHelper.ModifyAsync(this, Discord, func, options); | => ChannelHelper.ModifyAsync(this, Discord, func, options); | ||||
| //TODO: Use RPC cache | //TODO: Use RPC cache | ||||
| @@ -38,7 +38,7 @@ namespace Discord.Rpc | |||||
| VoiceStates = model.VoiceStates.Select(x => RpcVoiceState.Create(Discord, x)).ToImmutableArray(); | VoiceStates = model.VoiceStates.Select(x => RpcVoiceState.Create(Discord, x)).ToImmutableArray(); | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyVoiceChannelParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null) | |||||
| => ChannelHelper.ModifyAsync(this, Discord, func, options); | => ChannelHelper.ModifyAsync(this, Discord, func, options); | ||||
| private string DebuggerDisplay => $"{Name} ({Id}, Voice)"; | private string DebuggerDisplay => $"{Name} ({Id}, Voice)"; | ||||
| @@ -99,7 +99,7 @@ namespace Discord.Rpc | |||||
| } | } | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyMessageParams> func, RequestOptions options) | |||||
| public Task ModifyAsync(Action<MessageProperties> func, RequestOptions options) | |||||
| => MessageHelper.ModifyAsync(this, Discord, func, options); | => MessageHelper.ModifyAsync(this, Discord, func, options); | ||||
| public Task AddReactionAsync(Emoji emoji, RequestOptions options = null) | public Task AddReactionAsync(Emoji emoji, RequestOptions options = null) | ||||
| @@ -51,7 +51,7 @@ namespace Discord.WebSocket | |||||
| _overwrites = newOverwrites.ToImmutable(); | _overwrites = newOverwrites.ToImmutable(); | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyGuildChannelParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null) | |||||
| => ChannelHelper.ModifyAsync(this, Discord, func, options); | => ChannelHelper.ModifyAsync(this, Discord, func, options); | ||||
| public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
| => ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
| @@ -44,7 +44,7 @@ namespace Discord.WebSocket | |||||
| Topic = model.Topic.Value; | Topic = model.Topic.Value; | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyTextChannelParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null) | |||||
| => ChannelHelper.ModifyAsync(this, Discord, func, options); | => ChannelHelper.ModifyAsync(this, Discord, func, options); | ||||
| //Messages | //Messages | ||||
| @@ -38,7 +38,7 @@ namespace Discord.WebSocket | |||||
| UserLimit = model.UserLimit.Value; | UserLimit = model.UserLimit.Value; | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyVoiceChannelParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null) | |||||
| => ChannelHelper.ModifyAsync(this, Discord, func, options); | => ChannelHelper.ModifyAsync(this, Discord, func, options); | ||||
| public override SocketGuildUser GetUser(ulong id) | public override SocketGuildUser GetUser(ulong id) | ||||
| @@ -53,8 +53,8 @@ namespace Discord.WebSocket | |||||
| public DateTimeOffset CreatedAt => DateTimeUtils.FromSnowflake(Id); | public DateTimeOffset CreatedAt => DateTimeUtils.FromSnowflake(Id); | ||||
| public ulong DefaultChannelId => Id; | public ulong DefaultChannelId => Id; | ||||
| public string IconUrl => API.CDN.GetGuildIconUrl(Id, IconId); | |||||
| public string SplashUrl => API.CDN.GetGuildSplashUrl(Id, SplashId); | |||||
| public string IconUrl => CDN.GetGuildIconUrl(Id, IconId); | |||||
| public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId); | |||||
| public bool HasAllMembers => _downloaderPromise.Task.IsCompleted; | public bool HasAllMembers => _downloaderPromise.Task.IsCompleted; | ||||
| public bool IsSynced => _syncPromise.Task.IsCompleted; | public bool IsSynced => _syncPromise.Task.IsCompleted; | ||||
| public Task SyncPromise => _syncPromise.Task; | public Task SyncPromise => _syncPromise.Task; | ||||
| @@ -252,13 +252,13 @@ namespace Discord.WebSocket | |||||
| public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
| => GuildHelper.DeleteAsync(this, Discord, options); | => GuildHelper.DeleteAsync(this, Discord, options); | ||||
| public Task ModifyAsync(Action<ModifyGuildParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<GuildProperties> func, RequestOptions options = null) | |||||
| => GuildHelper.ModifyAsync(this, Discord, func, options); | => GuildHelper.ModifyAsync(this, Discord, func, options); | ||||
| public Task ModifyEmbedAsync(Action<ModifyGuildEmbedParams> func, RequestOptions options = null) | |||||
| public Task ModifyEmbedAsync(Action<GuildEmbedProperties> func, RequestOptions options = null) | |||||
| => GuildHelper.ModifyEmbedAsync(this, Discord, func, options); | => GuildHelper.ModifyEmbedAsync(this, Discord, func, options); | ||||
| public Task ModifyChannelsAsync(IEnumerable<ModifyGuildChannelsParams> args, RequestOptions options = null) | |||||
| public Task ModifyChannelsAsync(IEnumerable<BulkGuildChannelProperties> args, RequestOptions options = null) | |||||
| => GuildHelper.ModifyChannelsAsync(this, Discord, args, options); | => GuildHelper.ModifyChannelsAsync(this, Discord, args, options); | ||||
| public Task ModifyRolesAsync(IEnumerable<ModifyGuildRolesParams> args, RequestOptions options = null) | |||||
| public Task ModifyRolesAsync(IEnumerable<BulkRoleProperties> args, RequestOptions options = null) | |||||
| => GuildHelper.ModifyRolesAsync(this, Discord, args, options); | => GuildHelper.ModifyRolesAsync(this, Discord, args, options); | ||||
| public Task LeaveAsync(RequestOptions options = null) | public Task LeaveAsync(RequestOptions options = null) | ||||
| @@ -125,7 +125,7 @@ namespace Discord.WebSocket | |||||
| _reactions.Clear(); | _reactions.Clear(); | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyMessageParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null) | |||||
| => MessageHelper.ModifyAsync(this, Discord, func, options); | => MessageHelper.ModifyAsync(this, Discord, func, options); | ||||
| public Task AddReactionAsync(Emoji emoji, RequestOptions options = null) | public Task AddReactionAsync(Emoji emoji, RequestOptions options = null) | ||||
| @@ -46,7 +46,7 @@ namespace Discord.WebSocket | |||||
| Permissions = new GuildPermissions(model.Permissions); | Permissions = new GuildPermissions(model.Permissions); | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyGuildRoleParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null) | |||||
| => RoleHelper.ModifyAsync(this, Discord, func, options); | => RoleHelper.ModifyAsync(this, Discord, func, options); | ||||
| public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
| => RoleHelper.DeleteAsync(this, Discord, options); | => RoleHelper.DeleteAsync(this, Discord, options); | ||||
| @@ -102,7 +102,7 @@ namespace Discord.WebSocket | |||||
| _roleIds = roles.ToImmutable(); | _roleIds = roles.ToImmutable(); | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyGuildMemberParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<GuildUserProperties> func, RequestOptions options = null) | |||||
| => UserHelper.ModifyAsync(this, Discord, func, options); | => UserHelper.ModifyAsync(this, Discord, func, options); | ||||
| public Task KickAsync(RequestOptions options = null) | public Task KickAsync(RequestOptions options = null) | ||||
| => UserHelper.KickAsync(this, Discord, options); | => UserHelper.KickAsync(this, Discord, options); | ||||
| @@ -44,7 +44,7 @@ namespace Discord.WebSocket | |||||
| IsMfaEnabled = model.MfaEnabled.Value; | IsMfaEnabled = model.MfaEnabled.Value; | ||||
| } | } | ||||
| public Task ModifyAsync(Action<ModifyCurrentUserParams> func, RequestOptions options = null) | |||||
| public Task ModifyAsync(Action<SelfUserProperties> func, RequestOptions options = null) | |||||
| => UserHelper.ModifyAsync(this, Discord, func, options); | => UserHelper.ModifyAsync(this, Discord, func, options); | ||||
| internal new SocketSelfUser Clone() => MemberwiseClone() as SocketSelfUser; | internal new SocketSelfUser Clone() => MemberwiseClone() as SocketSelfUser; | ||||