@@ -20,19 +20,19 @@ internal class DiscordMentions
2020 /// Collection roles to serialize
2121 /// </summary>
2222 [ JsonProperty ( "roles" , NullValueHandling = NullValueHandling . Ignore ) ]
23- public IEnumerable < ulong > Roles { get ; }
23+ public IEnumerable < ulong > ? Roles { get ; }
2424
2525 /// <summary>
2626 /// Collection of users to serialize
2727 /// </summary>
2828 [ JsonProperty ( "users" , NullValueHandling = NullValueHandling . Ignore ) ]
29- public IEnumerable < ulong > Users { get ; }
29+ public IEnumerable < ulong > ? Users { get ; }
3030
3131 /// <summary>
3232 /// The values to be parsed
3333 /// </summary>
3434 [ JsonProperty ( "parse" , NullValueHandling = NullValueHandling . Ignore ) ]
35- public IEnumerable < string > Parse { get ; }
35+ public IEnumerable < string > ? Parse { get ; }
3636
3737 // WHY IS THERE NO DOCSTRING HERE
3838 [ JsonProperty ( "replied_user" , NullValueHandling = NullValueHandling . Ignore ) ]
@@ -41,7 +41,7 @@ internal class DiscordMentions
4141 internal DiscordMentions ( IEnumerable < IMention > mentions , bool mention = false , bool repliedUser = false )
4242 {
4343 //Null check just to be safe
44- if ( mentions == null )
44+ if ( mentions is null )
4545 {
4646 return ;
4747 }
@@ -52,21 +52,20 @@ internal DiscordMentions(IEnumerable<IMention> mentions, bool mention = false, b
5252 // Doing this allows for "no parsing"
5353 if ( ! mentions . Any ( ) )
5454 {
55- this . Parse = Array . Empty < string > ( ) ;
55+ this . Parse = [ ] ;
5656 return ;
5757 }
5858
5959
6060 //Prepare a list of allowed IDs. We will be adding to these IDs.
61- HashSet < ulong > roles = new HashSet < ulong > ( ) ;
62- HashSet < ulong > users = new HashSet < ulong > ( ) ;
63- HashSet < string > parse = new HashSet < string > ( ) ;
61+ HashSet < ulong > roles = [ ] ;
62+ HashSet < ulong > users = [ ] ;
63+ HashSet < string > parse = [ ] ;
6464
6565 foreach ( IMention m in mentions )
6666 {
6767 switch ( m )
6868 {
69- default : throw new NotSupportedException ( "Type not supported in mentions." ) ;
7069 case UserMention u :
7170 if ( u . Id . HasValue )
7271 {
@@ -97,6 +96,8 @@ internal DiscordMentions(IEnumerable<IMention> mentions, bool mention = false, b
9796
9897 case RepliedUserMention :
9998 break ;
99+
100+ default : throw new NotSupportedException ( $ "The type { m . GetType ( ) } is not supported in allowed mentions.") ;
100101 }
101102 }
102103
0 commit comments