Browse Source

clean up files and add documentation where missing

pull/1237/head
Chris Johnston 6 years ago
parent
commit
b0de4dd97f
10 changed files with 35 additions and 58 deletions
  1. +1
    -13
      src/Discord.Net.Core/Entities/Activities/Game.cs
  2. +6
    -27
      src/Discord.Net.Core/Entities/Activities/IActivity.cs
  3. +8
    -3
      src/Discord.Net.Core/Entities/Users/IUser.cs
  4. +1
    -6
      src/Discord.Net.Core/Entities/Users/PremiumType.cs
  5. +0
    -4
      src/Discord.Net.Core/Entities/Users/UserFlags.cs
  6. +9
    -1
      src/Discord.Net.Core/Extensions/ActivityExtensions.cs
  7. +8
    -0
      src/Discord.Net.Core/Extensions/UserExtensions.cs
  8. +2
    -2
      src/Discord.Net.Rest/Entities/Users/RestUser.cs
  9. +0
    -1
      src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs
  10. +0
    -1
      src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs

+ 1
- 13
src/Discord.Net.Core/Entities/Activities/Game.cs View File

@@ -12,19 +12,7 @@ namespace Discord
public string Name { get; internal set; }
/// <inheritdoc/>
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; }

internal Game() { }


+ 6
- 27
src/Discord.Net.Core/Entities/Activities/IActivity.cs View File

@@ -20,36 +20,15 @@ namespace Discord
/// </returns>
ActivityType Type { get; }
/// <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>
/// <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>
/// A string containing the URL to the stream.
/// The value of flags for this activity.
/// </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; }
}
}

+ 8
- 3
src/Discord.Net.Core/Entities/Users/IUser.cs View File

@@ -112,11 +112,16 @@ namespace Discord
/// contains the DM channel associated with this user.
/// </returns>
Task<IDMChannel> GetOrCreateDMChannelAsync(RequestOptions options = null);

/// <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>
/// <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; }
/// <summary>
/// The type of Nitro subscription


+ 1
- 6
src/Discord.Net.Core/Entities/Users/PremiumType.cs View File

@@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Discord
{
public enum PremiumType
{
None = 0,
/// <summary>
/// Includes app perks like animated emojis and avatars, but not games.
/// </summary>


+ 0
- 4
src/Discord.Net.Core/Entities/Users/UserFlags.cs View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Discord
{


+ 9
- 1
src/Discord.Net.Core/Extensions/ActivityExtensions.cs View File

@@ -5,7 +5,15 @@ namespace Discord
/// </summary>
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;
}
}

+ 8
- 0
src/Discord.Net.Core/Extensions/UserExtensions.cs View File

@@ -161,6 +161,14 @@ namespace Discord
public static Task BanAsync(this IGuildUser user, int pruneDays = 0, string reason = null, RequestOptions options = null)
=> 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)
=> (user.Flags & (int)flag) >= (int)flag;
}


+ 2
- 2
src/Discord.Net.Rest/Entities/Users/RestUser.cs View File

@@ -32,9 +32,9 @@ namespace Discord.Rest
public virtual UserStatus Status => UserStatus.Offline;
/// <inheritdoc />
public virtual bool IsWebhook => false;

// TODO clean this up
/// <inheritdoc />
public int Flags { get; private set; }
/// <inheritdoc />
public PremiumType? PremiumType { get; private set; }

internal RestUser(BaseDiscordClient discord, ulong id)


+ 0
- 1
src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs View File

@@ -194,6 +194,5 @@ namespace Discord.WebSocket
//IVoiceState
/// <inheritdoc />
IVoiceChannel IVoiceState.VoiceChannel => VoiceChannel;

}
}

+ 0
- 1
src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs View File

@@ -42,7 +42,6 @@ namespace Discord.WebSocket
public int Flags { get; internal set; }
/// <inheritdoc />
public PremiumType? PremiumType { get; internal set; }

/// <summary>
/// Gets mutual guilds shared with this user.
/// </summary>


Loading…
Cancel
Save