diff options
| author | Leah <[email protected]> | 2018-03-23 13:54:12 +0100 |
|---|---|---|
| committer | alex <[email protected]> | 2018-03-23 13:54:12 +0100 |
| commit | fdcf44e1463e708cd8b612c183e302db9af0febd (patch) | |
| tree | 1a311f26fb38522ba380881fa6e72c0c2e5c54bc /src/model/channel | |
| parent | Fix Create(Embed/Message) to be consistent (diff) | |
| download | serenity-fdcf44e1463e708cd8b612c183e302db9af0febd.tar.xz serenity-fdcf44e1463e708cd8b612c183e302db9af0febd.zip | |
Change the way ids and some enums are made (#295)
This makes them easier to be found by tools like rls.
Also update struct inits to use the shorthand version for `x: x`.
Diffstat (limited to 'src/model/channel')
| -rw-r--r-- | src/model/channel/message.rs | 46 | ||||
| -rw-r--r-- | src/model/channel/mod.rs | 53 |
2 files changed, 60 insertions, 39 deletions
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs index eefb633..566107b 100644 --- a/src/model/channel/message.rs +++ b/src/model/channel/message.rs @@ -605,25 +605,37 @@ pub struct MessageReaction { pub reaction_type: ReactionType, } +/// Differentiates between regular and different types of system messages. +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +pub enum MessageType { + /// A regular message. + Regular = 0, + /// An indicator that a recipient was added by the author. + GroupRecipientAddition = 1, + /// An indicator that a recipient was removed by the author. + GroupRecipientRemoval = 2, + /// An indicator that a call was started by the author. + GroupCallCreation = 3, + /// An indicator that the group name was modified by the author. + GroupNameUpdate = 4, + /// An indicator that the group icon was modified by the author. + GroupIconUpdate = 5, + /// An indicator that a message was pinned by the author. + PinsAdd = 6, + /// An indicator that a member joined the guild. + MemberJoin = 7, +} + enum_number!( - /// Differentiates between regular and different types of system messages. MessageType { - /// A regular message. - Regular = 0, - /// An indicator that a recipient was added by the author. - GroupRecipientAddition = 1, - /// An indicator that a recipient was removed by the author. - GroupRecipientRemoval = 2, - /// An indicator that a call was started by the author. - GroupCallCreation = 3, - /// An indicator that the group name was modified by the author. - GroupNameUpdate = 4, - /// An indicator that the group icon was modified by the author. - GroupIconUpdate = 5, - /// An indicator that a message was pinned by the author. - PinsAdd = 6, - /// An indicator that a member joined the guild. - MemberJoin = 7, + Regular, + GroupRecipientAddition, + GroupRecipientRemoval, + GroupCallCreation, + GroupNameUpdate, + GroupIconUpdate, + PinsAdd, + MemberJoin, } ); diff --git a/src/model/channel/mod.rs b/src/model/channel/mod.rs index eadc7bb..5487a0b 100644 --- a/src/model/channel/mod.rs +++ b/src/model/channel/mod.rs @@ -555,29 +555,38 @@ impl Display for Channel { } } +/// A representation of a type of channel. +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +pub enum ChannelType { + /// An indicator that the channel is a text [`GuildChannel`]. + /// + /// [`GuildChannel`]: struct.GuildChannel.html + Text = 0, + /// An indicator that the channel is a [`PrivateChannel`]. + /// + /// [`PrivateChannel`]: struct.PrivateChannel.html + Private = 1, + /// An indicator that the channel is a voice [`GuildChannel`]. + /// + /// [`GuildChannel`]: struct.GuildChannel.html + Voice = 2, + /// An indicator that the channel is the channel of a [`Group`]. + /// + /// [`Group`]: struct.Group.html + Group = 3, + /// An indicator that the channel is the channel of a [`ChannelCategory`]. + /// + /// [`ChannelCategory`]: struct.ChannelCategory.html + Category = 4, +} + enum_number!( - /// A representation of a type of channel. ChannelType { - #[doc="An indicator that the channel is a text [`GuildChannel`]. - -[`GuildChannel`]: struct.GuildChannel.html"] - Text = 0, - #[doc="An indicator that the channel is a [`PrivateChannel`]. - -[`PrivateChannel`]: struct.PrivateChannel.html"] - Private = 1, - #[doc="An indicator that the channel is a voice [`GuildChannel`]. - -[`GuildChannel`]: struct.GuildChannel.html"] - Voice = 2, - #[doc="An indicator that the channel is the channel of a [`Group`]. - -[`Group`]: struct.Group.html"] - Group = 3, - #[doc="An indicator that the channel is the channel of a [`ChannelCategory`]. - -[`ChannelCategory`]: struct.ChannelCategory.html"] - Category = 4, + Text, + Private, + Voice, + Group, + Category, } ); @@ -633,7 +642,7 @@ impl<'de> Deserialize<'de> for PermissionOverwrite { Ok(PermissionOverwrite { allow: data.allow, deny: data.deny, - kind: kind, + kind, }) } } |