@@ -12,19 +12,7 @@ namespace Discord | |||||
public string Name { get; internal set; } | public string Name { get; internal set; } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public ActivityType Type { get; internal set; } | public ActivityType Type { get; internal set; } | ||||
public string Url { get; internal set; } | |||||
public GameTimestamps Timestamps { get; internal set; } | |||||
public ulong ApplicationId { get; internal set; } | |||||
public string Details { get; internal set; } | |||||
public string State { get; internal set; } | |||||
public GameParty Party { get; internal set; } | |||||
public GameAsset Assets { get; internal set; } | |||||
public GameSecrets Secrets { get; internal set; } | |||||
public bool Instance { get; internal set; } | |||||
/// <inheritdoc/> | |||||
public int Flags { get; internal set; } | public int Flags { get; internal set; } | ||||
internal Game() { } | internal Game() { } | ||||
@@ -20,36 +20,15 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
ActivityType Type { get; } | ActivityType Type { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the Stream URL. Only used when <see cref="Type"/> is <see cref="ActivityType.Streaming"/>. | |||||
/// The flags that are relevant to this activity. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | |||||
/// This value is determined by bitwise OR-ing <see cref="ActivityFlag"/> values together. | |||||
/// Each flag's value can be checked using <see cref="ActivityExtensions.CheckActivityFlag(IActivity, ActivityFlag)"/> | |||||
/// </remarks> | |||||
/// <returns> | /// <returns> | ||||
/// A string containing the URL to the stream. | |||||
/// The value of flags for this activity. | |||||
/// </returns> | /// </returns> | ||||
string Url { get; } | |||||
/// <summary> | |||||
/// Gets the unix timestamps for the start and/or end of the activity. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// A <see cref="GameTimestamps"/> containing the start and end times, if specified. | |||||
/// </returns> | |||||
GameTimestamps Timestamps { get; } | |||||
/// <summary> | |||||
/// Gets the application Id for the game. | |||||
/// </summary> | |||||
ulong ApplicationId { get; } | |||||
/// <summary> | |||||
/// Gets what the user is currently doing. | |||||
/// </summary> | |||||
string Details { get; } | |||||
/// <summary> | |||||
/// Gets the user's current party status. | |||||
/// </summary> | |||||
string State { get; } | |||||
//TODO finish docs | |||||
GameParty Party { get; } | |||||
GameAsset Assets { get; } | |||||
GameSecrets Secrets { get; } | |||||
bool Instance { get; } | |||||
int Flags { get; } | int Flags { get; } | ||||
} | } | ||||
} | } |
@@ -112,11 +112,16 @@ namespace Discord | |||||
/// contains the DM channel associated with this user. | /// contains the DM channel associated with this user. | ||||
/// </returns> | /// </returns> | ||||
Task<IDMChannel> GetOrCreateDMChannelAsync(RequestOptions options = null); | Task<IDMChannel> GetOrCreateDMChannelAsync(RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// The flags on a user's account | |||||
/// TODO we could probably have extension methods for determining these | |||||
/// The flags that are applied to a user's account. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | |||||
/// This value is determined by bitwise OR-ing <see cref="UserFlag"/> values together. | |||||
/// Each flag's value can be checked using <see cref="UserExtensions.CheckUserFlag(IUser, UserFlag)"/> | |||||
/// </remarks> | |||||
/// <returns> | |||||
/// The value of flags for this user. | |||||
/// </returns> | |||||
int Flags { get; } | int Flags { get; } | ||||
/// <summary> | /// <summary> | ||||
/// The type of Nitro subscription | /// The type of Nitro subscription | ||||
@@ -1,13 +1,8 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
public enum PremiumType | public enum PremiumType | ||||
{ | { | ||||
None = 0, | |||||
/// <summary> | /// <summary> | ||||
/// Includes app perks like animated emojis and avatars, but not games. | /// Includes app perks like animated emojis and avatars, but not games. | ||||
/// </summary> | /// </summary> | ||||
@@ -1,8 +1,4 @@ | |||||
using System; | using System; | ||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
@@ -5,7 +5,15 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
public static class ActivityExtensions | public static class ActivityExtensions | ||||
{ | { | ||||
public static bool CheckFlag(this IActivity activity, ActivityFlag flag) | |||||
/// <summary> | |||||
/// Determines if the given flag is enabled with this activity. | |||||
/// </summary> | |||||
/// <param name="user">The user to check.</param> | |||||
/// <param name="flag">The <see cref="ActivityFlag"/> to check for.</param> | |||||
/// <returns> | |||||
/// True if the activity has this flag enabled, false otherwise. | |||||
/// </returns> | |||||
public static bool CheckActivityFlag(this IActivity activity, ActivityFlag flag) | |||||
=> (activity.Flags & (int)flag) >= (int)flag; | => (activity.Flags & (int)flag) >= (int)flag; | ||||
} | } | ||||
} | } |
@@ -161,6 +161,14 @@ namespace Discord | |||||
public static Task BanAsync(this IGuildUser user, int pruneDays = 0, string reason = null, RequestOptions options = null) | public static Task BanAsync(this IGuildUser user, int pruneDays = 0, string reason = null, RequestOptions options = null) | ||||
=> user.Guild.AddBanAsync(user, pruneDays, reason, options); | => user.Guild.AddBanAsync(user, pruneDays, reason, options); | ||||
/// <summary> | |||||
/// Determines if the user has a given flag applied to their account. | |||||
/// </summary> | |||||
/// <param name="user">The user to check.</param> | |||||
/// <param name="flag">The <see cref="UserFlag"/> to check for.</param> | |||||
/// <returns> | |||||
/// True if the user has the given flag on their account, otherwise false. | |||||
/// </returns> | |||||
public static bool CheckUserFlag(this IUser user, UserFlag flag) | public static bool CheckUserFlag(this IUser user, UserFlag flag) | ||||
=> (user.Flags & (int)flag) >= (int)flag; | => (user.Flags & (int)flag) >= (int)flag; | ||||
} | } | ||||
@@ -32,9 +32,9 @@ namespace Discord.Rest | |||||
public virtual UserStatus Status => UserStatus.Offline; | public virtual UserStatus Status => UserStatus.Offline; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public virtual bool IsWebhook => false; | public virtual bool IsWebhook => false; | ||||
// TODO clean this up | |||||
/// <inheritdoc /> | |||||
public int Flags { get; private set; } | public int Flags { get; private set; } | ||||
/// <inheritdoc /> | |||||
public PremiumType? PremiumType { get; private set; } | public PremiumType? PremiumType { get; private set; } | ||||
internal RestUser(BaseDiscordClient discord, ulong id) | internal RestUser(BaseDiscordClient discord, ulong id) | ||||
@@ -194,6 +194,5 @@ namespace Discord.WebSocket | |||||
//IVoiceState | //IVoiceState | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
IVoiceChannel IVoiceState.VoiceChannel => VoiceChannel; | IVoiceChannel IVoiceState.VoiceChannel => VoiceChannel; | ||||
} | } | ||||
} | } |
@@ -42,7 +42,6 @@ namespace Discord.WebSocket | |||||
public int Flags { get; internal set; } | public int Flags { get; internal set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public PremiumType? PremiumType { get; internal set; } | public PremiumType? PremiumType { get; internal set; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets mutual guilds shared with this user. | /// Gets mutual guilds shared with this user. | ||||
/// </summary> | /// </summary> | ||||