-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 changed file
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Sharphook.ResponseObjects; | ||
using Sharphook.Utility.Enums; | ||
|
||
namespace Sharphook; | ||
|
||
public class AllowedMentions | ||
{ | ||
public AllowedMentionType? AllowedTypes; | ||
public List<ulong> AllowedRoleMentions = new List<ulong>(); | ||
public List<ulong> AllowedUserMentions = new List<ulong>(); | ||
|
||
public static AllowedMentions All => new AllowedMentions( | ||
AllowedMentionType.Everyone | AllowedMentionType.Roles | AllowedMentionType.Users); | ||
|
||
public static AllowedMentions None => new AllowedMentions(); | ||
|
||
public AllowedMentions(AllowedMentionType? allowedTypes = null) | ||
{ | ||
AllowedTypes = allowedTypes; | ||
} | ||
|
||
internal AllowedMentionsObject ToAllowedMentionsObject() | ||
{ | ||
AllowedMentionsObject allowedMentionsObject = new AllowedMentionsObject(); | ||
allowedMentionsObject.Parse = new List<string>(); | ||
|
||
if ((AllowedTypes & AllowedMentionType.Everyone) == AllowedMentionType.Everyone) | ||
allowedMentionsObject.Parse.Add("everyone"); | ||
|
||
if ((AllowedTypes & AllowedMentionType.Roles) == AllowedMentionType.Roles) | ||
allowedMentionsObject.Parse.Add("roles"); | ||
else | ||
allowedMentionsObject.Roles = AllowedRoleMentions.ToArray(); | ||
|
||
if ((AllowedTypes & AllowedMentionType.Users) == AllowedMentionType.Users) | ||
allowedMentionsObject.Parse.Add("users"); | ||
else | ||
allowedMentionsObject.Users = AllowedUserMentions.ToArray(); | ||
|
||
return allowedMentionsObject; | ||
} | ||
} |