Update Guild and Message Models (#1165)
* Add ExplicitContentFilter property to Guild * re-order properties to match order listed on api docs * re-order SystemChannelId to match api docs * Implement ApplicationId in Guild model * Add ExplicitContentFilter property to Guild * re-order properties to match order listed on api docs * re-order SystemChannelId to match api docs * Implement ApplicationId in Guild model * Improve xmldoc for IGuild ExplicitContentFilter * Update xmldoc * docs "Id" -> "ID" * rename Test.GuildPermissions to a more general Test.Guilds * Add ExplicitContentFilter to GuildProperties * Add a test for ExplicitContentFilterLevel modification behavior * Implement ModifyAsync behavior * simplify ExplicitContentFilter test * Add RestGuild ApplicationId inheritdoc * Implement message Activity and Application model update * RestMessage Application and Activity implementation * add ToString to MessageApplication * Add IconUrl property to MessageApplication * clean up whitespace * another excessive whitespace removal
This commit is contained in:
committed by
Christopher F
parent
10f67a8098
commit
d30d12246d
@@ -32,7 +32,8 @@ namespace Discord.Rest
|
||||
Icon = args.Icon.IsSpecified ? args.Icon.Value?.ToModel() : Optional.Create<ImageModel?>(),
|
||||
Name = args.Name,
|
||||
Splash = args.Splash.IsSpecified ? args.Splash.Value?.ToModel() : Optional.Create<ImageModel?>(),
|
||||
VerificationLevel = args.VerificationLevel
|
||||
VerificationLevel = args.VerificationLevel,
|
||||
ExplicitContentFilter = args.ExplicitContentFilter
|
||||
};
|
||||
|
||||
if (args.AfkChannel.IsSpecified)
|
||||
@@ -60,6 +61,9 @@ namespace Discord.Rest
|
||||
if (!apiArgs.Icon.IsSpecified && guild.IconId != null)
|
||||
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);
|
||||
}
|
||||
/// <exception cref="ArgumentNullException"><paramref name="func"/> is <c>null</c>.</exception>
|
||||
|
||||
@@ -32,6 +32,8 @@ namespace Discord.Rest
|
||||
public MfaLevel MfaLevel { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public DefaultMessageNotifications DefaultMessageNotifications { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public ExplicitContentFilterLevel ExplicitContentFilter { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ulong? AFKChannelId { get; private set; }
|
||||
@@ -48,6 +50,8 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
public string SplashId { get; private set; }
|
||||
internal bool Available { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public ulong? ApplicationId { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
|
||||
@@ -98,6 +102,8 @@ namespace Discord.Rest
|
||||
VerificationLevel = model.VerificationLevel;
|
||||
MfaLevel = model.MfaLevel;
|
||||
DefaultMessageNotifications = model.DefaultMessageNotifications;
|
||||
ExplicitContentFilter = model.ExplicitContentFilter;
|
||||
ApplicationId = model.ApplicationId;
|
||||
|
||||
if (model.Emojis != null)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,10 @@ namespace Discord.Rest
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTimeOffset Timestamp => DateTimeUtils.FromTicks(_timestampTicks);
|
||||
/// <inheritdoc />
|
||||
public MessageActivity Activity { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public MessageApplication Application { get; private set; }
|
||||
|
||||
internal RestMessage(BaseDiscordClient discord, ulong id, IMessageChannel channel, IUser author, MessageSource source)
|
||||
: base(discord, id)
|
||||
@@ -77,6 +81,29 @@ namespace Discord.Rest
|
||||
|
||||
if (model.Content.IsSpecified)
|
||||
Content = model.Content.Value;
|
||||
|
||||
if (model.Application.IsSpecified)
|
||||
{
|
||||
// create a new Application from the API model
|
||||
Application = new MessageApplication()
|
||||
{
|
||||
Id = model.Application.Value.Id,
|
||||
CoverImage = model.Application.Value.CoverImage,
|
||||
Description = model.Application.Value.Description,
|
||||
Icon = model.Application.Value.Icon,
|
||||
Name = model.Application.Value.Name
|
||||
};
|
||||
}
|
||||
|
||||
if (model.Activity.IsSpecified)
|
||||
{
|
||||
// create a new Activity from the API model
|
||||
Activity = new MessageActivity()
|
||||
{
|
||||
Type = model.Activity.Value.Type.Value,
|
||||
PartyId = model.Activity.Value.PartyId.Value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user