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:
Chris Johnston
2018-10-19 14:20:41 -07:00
committed by Christopher F
parent 10f67a8098
commit d30d12246d
18 changed files with 302 additions and 8 deletions

View File

@@ -50,6 +50,8 @@ namespace Discord.WebSocket
public MfaLevel MfaLevel { get; private set; }
/// <inheritdoc />
public DefaultMessageNotifications DefaultMessageNotifications { get; private set; }
/// <inheritdoc />
public ExplicitContentFilterLevel ExplicitContentFilter { get; private set; }
/// <summary>
/// Gets the number of members.
/// </summary>
@@ -73,6 +75,8 @@ namespace Discord.WebSocket
internal bool IsAvailable { get; private set; }
/// <summary> Indicates whether the client is connected to this guild. </summary>
public bool IsConnected { get; internal set; }
/// <inheritdoc />
public ulong? ApplicationId { get; internal set; }
internal ulong? AFKChannelId { get; private set; }
internal ulong? EmbedChannelId { get; private set; }
@@ -346,6 +350,8 @@ namespace Discord.WebSocket
VerificationLevel = model.VerificationLevel;
MfaLevel = model.MfaLevel;
DefaultMessageNotifications = model.DefaultMessageNotifications;
ExplicitContentFilter = model.ExplicitContentFilter;
ApplicationId = model.ApplicationId;
if (model.Emojis != null)
{

View File

@@ -43,6 +43,13 @@ namespace Discord.WebSocket
public virtual bool IsPinned => false;
/// <inheritdoc />
public virtual DateTimeOffset? EditedTimestamp => null;
/// <inheritdoc />
public MessageActivity Activity { get; private set; }
/// <inheritdoc />
public MessageApplication Application { get; private set; }
/// <summary>
/// Returns all attachments included in this message.
/// </summary>
@@ -105,6 +112,29 @@ namespace Discord.WebSocket
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 />