Browse Source

Implement ModifyAsync behavior

pull/1165/head
Chris Johnston 7 years ago
parent
commit
7654acd686
2 changed files with 8 additions and 2 deletions
  1. +3
    -1
      src/Discord.Net.Rest/API/Rest/ModifyGuildParams.cs
  2. +5
    -1
      src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs

+ 3
- 1
src/Discord.Net.Rest/API/Rest/ModifyGuildParams.cs View File

@@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using Newtonsoft.Json; using Newtonsoft.Json;


namespace Discord.API.Rest namespace Discord.API.Rest
@@ -28,5 +28,7 @@ namespace Discord.API.Rest
public Optional<ulong?> AfkChannelId { get; set; } public Optional<ulong?> AfkChannelId { get; set; }
[JsonProperty("owner_id")] [JsonProperty("owner_id")]
public Optional<ulong> OwnerId { get; set; } public Optional<ulong> OwnerId { get; set; }
[JsonProperty("explicit_content_filter")]
public Optional<ExplicitContentFilterLevel> ExplicitContentFilter { get; set; }
} }
} }

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

@@ -32,7 +32,8 @@ namespace Discord.Rest
Icon = args.Icon.IsSpecified ? args.Icon.Value?.ToModel() : Optional.Create<ImageModel?>(), Icon = args.Icon.IsSpecified ? args.Icon.Value?.ToModel() : Optional.Create<ImageModel?>(),
Name = args.Name, Name = args.Name,
Splash = args.Splash.IsSpecified ? args.Splash.Value?.ToModel() : Optional.Create<ImageModel?>(), Splash = args.Splash.IsSpecified ? args.Splash.Value?.ToModel() : Optional.Create<ImageModel?>(),
VerificationLevel = args.VerificationLevel
VerificationLevel = args.VerificationLevel,
ExplicitContentFilter = args.ExplicitContentFilter
}; };


if (args.AfkChannel.IsSpecified) if (args.AfkChannel.IsSpecified)
@@ -60,6 +61,9 @@ namespace Discord.Rest
if (!apiArgs.Icon.IsSpecified && guild.IconId != null) if (!apiArgs.Icon.IsSpecified && guild.IconId != null)
apiArgs.Icon = new ImageModel(guild.IconId); apiArgs.Icon = new ImageModel(guild.IconId);


if (args.ExplicitContentFilter.IsSpecified)
apiArgs.ExplicitContentFilter = args.ExplicitContentFilter.Value;

return await client.ApiClient.ModifyGuildAsync(guild.Id, apiArgs, options).ConfigureAwait(false); return await client.ApiClient.ModifyGuildAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
} }
/// <exception cref="ArgumentNullException"><paramref name="func"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException"><paramref name="func"/> is <c>null</c>.</exception>


Loading…
Cancel
Save