File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ use crate::internal::prelude::*;
1212use crate :: model:: prelude:: * ;
1313use crate :: model:: utils:: is_false;
1414
15+ fn minus1_as_0 < ' de , D : serde:: Deserializer < ' de > > ( deserializer : D ) -> Result < u16 , D :: Error > {
16+ i16:: deserialize ( deserializer) . map ( |val| if val == -1 { 0 } else { val as u16 } )
17+ }
18+
1519/// Information about a role within a guild.
1620///
1721/// A role represents a set of permissions, and can be attached to one or multiple users. A role has
@@ -57,6 +61,7 @@ pub struct Role {
5761 /// position is higher.
5862 ///
5963 /// The `@everyone` role is usually either `-1` or `0`.
64+ #[ serde( deserialize_with = "minus1_as_0" ) ]
6065 pub position : u16 ,
6166 /// The tags this role has. It can be used to determine if this role is a special role in this
6267 /// guild such as guild subscriber role, or if the role is linked to an [`Integration`] or a
You can’t perform that action at this time.
0 commit comments