[ifcbrk] feature: BOOST (#1319)

* add new MessageTypes

* Add new properties to the updated models

* add the SystemChannelMessageDeny

unsure if there would be a better name for this enum, given it's inverted nature, open for suggestions

* add PremiumTier flag, add Guild description property

* add method for getting vanity image from CDN

* make the size of GetGuildVanityUrl optional

* lint: remove commented out code from prev commit

* add a None flag to SystemChannelMessage enum

* implement the new modify guild params

* implement additional model properties in IGuild types

* implement GuildMember PremiumSince

* docs: reword size param explanation

* add extension methods that make it easier to check the SystemChannelMessage flags for end users

because the flag is inverted, this ideally should make it easier for the user. it may also be useful to do something similar for modifying this property

* docs: correct typo from copy-paste

* add the premium_subscription_count property

* fix vanity url code and banner switchup

a mistake was made somewhere, that's all I know for sure

* clarify remark on inverted logic for system channel flags

* fix PremiumSubscriptionCount optional value

* add another example to the systemchannelflags xmldoc remark

* docs: fix typos, clarify wording

* use DateTimeOffset for PremiumSince, follow conventions from other prop
This commit is contained in:
Chris Johnston
2019-06-21 14:34:45 -07:00
committed by Christopher F
parent d6d4429c3d
commit faf23dee35
18 changed files with 252 additions and 5 deletions

View File

@@ -93,6 +93,18 @@ namespace Discord.WebSocket
public string IconId { get; private set; }
/// <inheritdoc />
public string SplashId { get; private set; }
/// <inheritdoc />
public PremiumTier PremiumTier { get; private set; }
/// <inheritdoc />
public string BannerId { get; private set; }
/// <inheritdoc />
public string VanityURLCode { get; private set; }
/// <inheritdoc />
public SystemChannelMessageDeny SystemChannelFlags { get; private set; }
/// <inheritdoc />
public string Description { get; private set; }
/// <inheritdoc />
public int PremiumSubscriptionCount { get; private set; }
/// <inheritdoc />
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
@@ -100,6 +112,8 @@ namespace Discord.WebSocket
public string IconUrl => CDN.GetGuildIconUrl(Id, IconId);
/// <inheritdoc />
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId);
/// <inheritdoc />
public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId);
/// <summary> Indicates whether the client has all the members downloaded to the local guild cache. </summary>
public bool HasAllMembers => MemberCount == DownloadedMemberCount;// _downloaderPromise.Task.IsCompleted;
/// <summary> Indicates whether the guild cache is synced to this guild. </summary>
@@ -354,6 +368,12 @@ namespace Discord.WebSocket
DefaultMessageNotifications = model.DefaultMessageNotifications;
ExplicitContentFilter = model.ExplicitContentFilter;
ApplicationId = model.ApplicationId;
PremiumTier = model.PremiumTier;
VanityURLCode = model.VanityURLCode;
BannerId = model.Banner;
SystemChannelFlags = model.SystemChannelFlags;
Description = model.Description;
PremiumSubscriptionCount = model.PremiumSubscriptionCount.GetValueOrDefault();
if (model.Emojis != null)
{

View File

@@ -18,6 +18,7 @@ namespace Discord.WebSocket
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketGuildUser : SocketUser, IGuildUser
{
private long? _premiumSinceTicks;
private long? _joinedAtTicks;
private ImmutableArray<ulong> _roleIds;
@@ -75,6 +76,8 @@ namespace Discord.WebSocket
/// </returns>
public SocketVoiceState? VoiceState => Guild.GetVoiceState(Id);
public AudioInStream AudioStream => Guild.GetAudioStream(Id);
/// <inheritdoc />
public DateTimeOffset? PremiumSince => DateTimeUtils.FromTicks(_premiumSinceTicks);
/// <summary>
/// Returns the position of the user within the role hierarchy.
@@ -135,6 +138,8 @@ namespace Discord.WebSocket
Nickname = model.Nick.Value;
if (model.Roles.IsSpecified)
UpdateRoles(model.Roles.Value);
if (model.PremiumSince.IsSpecified)
_premiumSinceTicks = model.PremiumSince.Value?.UtcTicks;
}
internal void Update(ClientState state, PresenceModel model, bool updatePresence)
{

View File

@@ -63,6 +63,8 @@ namespace Discord.WebSocket
/// <inheritdoc />
string IGuildUser.Nickname => null;
/// <inheritdoc />
DateTimeOffset? IGuildUser.PremiumSince => null;
/// <inheritdoc />
GuildPermissions IGuildUser.GuildPermissions => GuildPermissions.Webhook;
/// <inheritdoc />