-
-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
397 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
namespace Discord; | ||
|
||
/// <summary> | ||
/// Represents the source of a user joining a guild. | ||
/// </summary> | ||
public enum JoinSourceType | ||
{ | ||
/// <summary> | ||
/// Unknown source. | ||
/// </summary> | ||
Unknown = 0, | ||
|
||
/// <summary> | ||
/// The user was invited by a bot. | ||
/// </summary> | ||
BotInvite = 1, | ||
|
||
/// <summary> | ||
/// The user was invited by an integration. | ||
/// </summary> | ||
Integration = 2, | ||
|
||
/// <summary> | ||
/// The user joined via server discovery. | ||
/// </summary> | ||
ServerDiscovery = 3, | ||
|
||
/// <summary> | ||
/// The user joined via the student hub. | ||
/// </summary> | ||
StudentHub = 4, | ||
|
||
/// <summary> | ||
/// The user joined via an invite code. | ||
/// </summary> | ||
InviteCode = 5, | ||
|
||
/// <summary> | ||
/// The user joined via a vanity URL. | ||
/// </summary> | ||
VanityUrl = 6, | ||
|
||
/// <summary> | ||
/// The user was manually verified | ||
/// </summary> | ||
ManualVerification = 7 | ||
} |
114 changes: 112 additions & 2 deletions
114
src/Discord.Net.Core/Entities/Guilds/MemberSearchPropertiesV2.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,129 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Discord; | ||
|
||
/// <summary> | ||
/// Represents the properties for searching members in a guild. | ||
/// </summary> | ||
public class MemberSearchPropertiesV2 | ||
{ | ||
/// <summary> | ||
/// Gets or sets the after property for the search. | ||
/// </summary> | ||
public MemberSearchPropertiesV2After After { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the sort type for the search. | ||
/// </summary> | ||
public MemberSearchV2SortType Sort { get; set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public MemberSearchV2QueryParams? AndQuery { get; set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public MemberSearchV2QueryParams? OrQuery { get; set; } | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Represents the after property for searching members in a guild. | ||
/// </summary> | ||
public struct MemberSearchPropertiesV2After | ||
{ | ||
/// <summary> | ||
/// Gets or sets the user ID to search after. | ||
/// </summary> | ||
public ulong UserId { get; set; } | ||
|
||
public ulong GuildJoinedAt { get; set; } | ||
/// <summary> | ||
/// Gets or sets the guild joined at timestamp to search after. | ||
/// </summary> | ||
public long GuildJoinedAt { get; set; } | ||
|
||
public MemberSearchPropertiesV2After(ulong userId, ulong guildJoinedAt) | ||
public MemberSearchPropertiesV2After(ulong userId, long guildJoinedAt) | ||
{ | ||
UserId = userId; | ||
GuildJoinedAt = guildJoinedAt; | ||
} | ||
|
||
public MemberSearchPropertiesV2After(ulong userId, DateTimeOffset guildJoinedAt) | ||
{ | ||
UserId = userId; | ||
GuildJoinedAt = guildJoinedAt.ToUnixTimeMilliseconds(); | ||
} | ||
} | ||
|
||
public struct MemberSearchV2QueryParams | ||
{ | ||
public MemberSearchV2SafetySignalsProperties? SafetySignals { get; set; } | ||
|
||
public MemberSearchV2QueryProperties? RoleIds { get; set; } | ||
|
||
public MemberSearchV2RangeProperties? UserId { get; set; } | ||
|
||
public MemberSearchV2RangeProperties? GuildJoinedAt { get; set; } | ||
|
||
public MemberSearchV2QueryProperties? SourceInviteCode { get; set; } | ||
|
||
public MemberSearchV2QueryProperties? JoinSourceType { get; set; } | ||
} | ||
|
||
public struct MemberSearchV2SafetySignalsProperties | ||
{ | ||
public MemberSearchV2SafetySignalProperties? UnusualDmActivityUntil { get; set; } | ||
|
||
public MemberSearchV2SafetySignalProperties? CommunicationDisabledUntil { get; set; } | ||
|
||
public bool? UnusualAccountActivity { get; set; } | ||
|
||
public bool? AutomodQuarantinedUsername { get; set; } | ||
} | ||
|
||
public readonly struct MemberSearchV2QueryProperties | ||
{ | ||
public Dictionary<int, object> AndQuery { get; } | ||
|
||
public Dictionary<int, object> OrQuery { get; } | ||
|
||
public MemberSearchV2QueryProperties(Dictionary<int, object> andQuery, Dictionary<int, object> orQuery) | ||
{ | ||
AndQuery = andQuery; | ||
OrQuery = orQuery; | ||
} | ||
|
||
public MemberSearchV2QueryProperties(Dictionary<int, string> andQuery, Dictionary<int, string> orQuery) | ||
{ | ||
AndQuery = andQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary(); | ||
OrQuery = orQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary(); | ||
} | ||
|
||
public MemberSearchV2QueryProperties(Dictionary<int, long> andQuery, Dictionary<int, long> orQuery) | ||
{ | ||
AndQuery = andQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary(); | ||
OrQuery = orQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary(); | ||
} | ||
} | ||
|
||
public struct MemberSearchV2SafetySignalProperties | ||
{ | ||
public MemberSearchV2RangeProperties Range { get; set; } | ||
} | ||
|
||
public struct MemberSearchV2RangeProperties | ||
{ | ||
/// <summary> | ||
/// Gets or sets the less than property for the search. | ||
/// </summary> | ||
public long? LessThanOrEqual { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the greater than property for the search. | ||
/// </summary> | ||
public long? GreaterThanOrEqual { get; set; } | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Discord.Net.Core/Entities/Guilds/MemberSearchV2SortType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace Discord; | ||
|
||
/// <summary> | ||
/// Represents the sort type for searching members in a guild. | ||
/// </summary> | ||
public enum MemberSearchV2SortType | ||
{ | ||
/// <summary> | ||
/// Sort by member since newest first. | ||
/// </summary> | ||
MemberSinceNewestFirst = 1, | ||
|
||
/// <summary> | ||
/// Sort by member since oldest first. | ||
/// </summary> | ||
MemberSinceOldestFirst = 2, | ||
|
||
/// <summary> | ||
/// Sort by joined discord since newest first. | ||
/// </summary> | ||
JoinedDiscordNewestFirst = 3, | ||
|
||
/// <summary> | ||
/// Sort by joined discord since oldest first. | ||
/// </summary> | ||
JoinedDiscordOldestFirst = 4, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.