Browse Source

Renamed new params classes to XXXProperties

tags/1.0-rc
RogueException 8 years ago
parent
commit
572c0e6c6b
45 changed files with 81 additions and 83 deletions
  1. +2
    -2
      src/Discord.Net.Core/Entities/Channels/BulkGuildChannelProperties.cs
  2. +1
    -1
      src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs
  3. +1
    -1
      src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs
  4. +1
    -1
      src/Discord.Net.Core/Entities/Channels/ITextChannel.cs
  5. +1
    -1
      src/Discord.Net.Core/Entities/Channels/IVoiceChannel.cs
  6. +1
    -1
      src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs
  7. +1
    -1
      src/Discord.Net.Core/Entities/Channels/VoiceChannelProperties.cs
  8. +1
    -1
      src/Discord.Net.Core/Entities/Guilds/GuildEmbedProperties.cs
  9. +1
    -1
      src/Discord.Net.Core/Entities/Guilds/GuildIntegrationProperties.cs
  10. +1
    -1
      src/Discord.Net.Core/Entities/Guilds/GuildProperties.cs
  11. +4
    -4
      src/Discord.Net.Core/Entities/Guilds/IGuild.cs
  12. +1
    -1
      src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
  13. +1
    -1
      src/Discord.Net.Core/Entities/Messages/MessageProperties.cs
  14. +2
    -2
      src/Discord.Net.Core/Entities/Roles/BulkRoleProperties.cs
  15. +1
    -1
      src/Discord.Net.Core/Entities/Roles/IRole.cs
  16. +1
    -1
      src/Discord.Net.Core/Entities/Roles/RoleProperties.cs
  17. +8
    -1
      src/Discord.Net.Core/Entities/Users/GuildUserProperties.cs
  18. +1
    -1
      src/Discord.Net.Core/Entities/Users/IGuildUser.cs
  19. +1
    -2
      src/Discord.Net.Core/Entities/Users/ISelfUser.cs
  20. +0
    -12
      src/Discord.Net.Core/Entities/Users/ModifyCurrentUserNickParams.cs
  21. +1
    -1
      src/Discord.Net.Core/Entities/Users/SelfUserProperties.cs
  22. +2
    -2
      src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
  23. +1
    -1
      src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs
  24. +6
    -6
      src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
  25. +4
    -4
      src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
  26. +2
    -2
      src/Discord.Net.Rest/Entities/Guilds/RestGuildIntegration.cs
  27. +2
    -2
      src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
  28. +1
    -1
      src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
  29. +1
    -1
      src/Discord.Net.Rest/Entities/Roles/RestRole.cs
  30. +2
    -2
      src/Discord.Net.Rest/Entities/Roles/RoleHelper.cs
  31. +1
    -1
      src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs
  32. +1
    -1
      src/Discord.Net.Rest/Entities/Users/RestSelfUser.cs
  33. +9
    -5
      src/Discord.Net.Rest/Entities/Users/UserHelper.cs
  34. +1
    -1
      src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs
  35. +1
    -1
      src/Discord.Net.Rpc/Entities/Channels/RpcTextChannel.cs
  36. +1
    -1
      src/Discord.Net.Rpc/Entities/Channels/RpcVoiceChannel.cs
  37. +1
    -1
      src/Discord.Net.Rpc/Entities/Messages/RpcUserMessage.cs
  38. +1
    -1
      src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
  39. +1
    -1
      src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
  40. +1
    -1
      src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs
  41. +6
    -6
      src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
  42. +1
    -1
      src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs
  43. +1
    -1
      src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs
  44. +1
    -1
      src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs
  45. +1
    -1
      src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs

src/Discord.Net.Core/Entities/Channels/ModifyGuildChannelsParams.cs → src/Discord.Net.Core/Entities/Channels/BulkGuildChannelProperties.cs View File

@@ -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;

src/Discord.Net.Core/Entities/Channels/ModifyGuildChannelParams.cs → src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs View File

@@ -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

+ 1
- 1
src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs View File

@@ -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);


+ 1
- 1
src/Discord.Net.Core/Entities/Channels/ITextChannel.cs View File

@@ -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);
} }
} }

+ 1
- 1
src/Discord.Net.Core/Entities/Channels/IVoiceChannel.cs View File

@@ -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();
} }

src/Discord.Net.Core/Entities/Channels/ModifyTextChannelParams.cs → src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs View File

@@ -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.

src/Discord.Net.Core/Entities/Channels/ModifyVoiceChannelParams.cs → src/Discord.Net.Core/Entities/Channels/VoiceChannelProperties.cs View File

@@ -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

src/Discord.Net.Core/Entities/Guilds/ModifyGuildEmbedParams.cs → src/Discord.Net.Core/Entities/Guilds/GuildEmbedProperties.cs View File

@@ -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?

src/Discord.Net.Core/Entities/Guilds/ModifyGuildIntegrationParams.cs → src/Discord.Net.Core/Entities/Guilds/GuildIntegrationProperties.cs View File

@@ -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; }

src/Discord.Net.Core/Entities/Guilds/ModifyGuildParams.cs → src/Discord.Net.Core/Entities/Guilds/GuildProperties.cs View File

@@ -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>

+ 4
- 4
src/Discord.Net.Core/Entities/Guilds/IGuild.cs View File

@@ -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);




+ 1
- 1
src/Discord.Net.Core/Entities/Messages/IUserMessage.cs View File

@@ -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>


src/Discord.Net.Core/Entities/Messages/ModifyMessageParams.cs → src/Discord.Net.Core/Entities/Messages/MessageProperties.cs View File

@@ -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

src/Discord.Net.Core/Entities/Roles/ModifyGuildRolesParams.cs → src/Discord.Net.Core/Entities/Roles/BulkRoleProperties.cs View File

@@ -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;
} }

+ 1
- 1
src/Discord.Net.Core/Entities/Roles/IRole.cs View File

@@ -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);
} }
} }

src/Discord.Net.Core/Entities/Roles/ModifyGuildRoleParams.cs → src/Discord.Net.Core/Entities/Roles/RoleProperties.cs View File

@@ -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

src/Discord.Net.Core/Entities/Users/ModifyGuildMemberParams.cs → src/Discord.Net.Core/Entities/Users/GuildUserProperties.cs View File

@@ -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; }
} }
} }

+ 1
- 1
src/Discord.Net.Core/Entities/Users/IGuildUser.cs View File

@@ -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
- 2
src/Discord.Net.Core/Entities/Users/ISelfUser.cs View File

@@ -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);
} }
} }

+ 0
- 12
src/Discord.Net.Core/Entities/Users/ModifyCurrentUserNickParams.cs View File

@@ -1,12 +0,0 @@
namespace Discord
{
public class ModifyCurrentUserNickParams
{
public string Nickname { get; }

public ModifyCurrentUserNickParams(string nickname)
{
Nickname = nickname;
}
}
}

src/Discord.Net.Core/Entities/Users/ModifyCurrentUserParams.cs → src/Discord.Net.Core/Entities/Users/SelfUserProperties.cs View File

@@ -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

+ 2
- 2
src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs View File

@@ -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
{ {


+ 1
- 1
src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs View File

@@ -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);


+ 6
- 6
src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs View File

@@ -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)
{ {


+ 4
- 4
src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs View File

@@ -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)


+ 2
- 2
src/Discord.Net.Rest/Entities/Guilds/RestGuildIntegration.cs View File

@@ -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
{ {


+ 2
- 2
src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs View File

@@ -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
{ {


+ 1
- 1
src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs View File

@@ -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);


+ 1
- 1
src/Discord.Net.Rest/Entities/Roles/RestRole.cs View File

@@ -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);


+ 2
- 2
src/Discord.Net.Rest/Entities/Roles/RoleHelper.cs View File

@@ -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
{ {


+ 1
- 1
src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs View File

@@ -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)


+ 1
- 1
src/Discord.Net.Rest/Entities/Users/RestSelfUser.cs View File

@@ -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
- 5
src/Discord.Net.Rest/Entities/Users/UserHelper.cs View File

@@ -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)


+ 1
- 1
src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs View File

@@ -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);


+ 1
- 1
src/Discord.Net.Rpc/Entities/Channels/RpcTextChannel.cs View File

@@ -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


+ 1
- 1
src/Discord.Net.Rpc/Entities/Channels/RpcVoiceChannel.cs View File

@@ -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)";


+ 1
- 1
src/Discord.Net.Rpc/Entities/Messages/RpcUserMessage.cs View File

@@ -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)


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs View File

@@ -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);


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs View File

@@ -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


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs View File

@@ -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)


+ 6
- 6
src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs View File

@@ -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)


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs View File

@@ -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)


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs View File

@@ -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);


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs View File

@@ -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);


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs View File

@@ -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;


Loading…
Cancel
Save