aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2018-06-20 07:56:56 -0700
committerZeyla Hellyer <[email protected]>2018-06-27 10:23:25 -0700
commit3a647e3b7f6762fa6a078bc539e5b3e8012b37d4 (patch)
tree9bed78bb3c7c999cbe216accc4f0210483212fa3 /src/model
parentAdd CreateEmbed::Field/s to 11_create_message_builder example (#338) (diff)
downloadserenity-3a647e3b7f6762fa6a078bc539e5b3e8012b37d4.tar.xz
serenity-3a647e3b7f6762fa6a078bc539e5b3e8012b37d4.zip
Make guild optional on Invites
Make the `guild` structfield on `Invite` and `RichInvite` optional. This was done due to a change in the [docs]. [docs]: https://github.com/discordapp/discord-api-docs/commit/bc0a15bd11db72644633080903171fbc3e71b026
Diffstat (limited to 'src/model')
-rw-r--r--src/model/invite.rs28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/model/invite.rs b/src/model/invite.rs
index 6573e35..b93b231 100644
--- a/src/model/invite.rs
+++ b/src/model/invite.rs
@@ -37,9 +37,15 @@ pub struct Invite {
///
/// [`GuildChannel`]: struct.GuildChannel.html
pub channel: InviteChannel,
- /// a representation of the minimal amount of information needed about the
+ /// A representation of the minimal amount of information needed about the
/// [`Guild`] being invited to.
- pub guild: InviteGuild,
+ ///
+ /// This can be `None` if the invite is to a [`Group`] and not to a
+ /// Guild.
+ ///
+ /// [`Guild`]: ../guild/struct.Guild.html
+ /// [`Group`]: ../channel/struct.Group.html
+ pub guild: Option<InviteGuild>,
}
#[cfg(feature = "model")]
@@ -136,14 +142,14 @@ impl Invite {
/// # name: "foo".to_string(),
/// # kind: ChannelType::Text,
/// # },
- /// # guild: InviteGuild {
+ /// # guild: Some(InviteGuild {
/// # id: GuildId(2),
/// # icon: None,
/// # name: "bar".to_string(),
/// # splash_hash: None,
/// # text_channel_count: Some(7),
/// # voice_channel_count: Some(3),
- /// # },
+ /// # }),
/// # };
/// #
/// assert_eq!(invite.url(), "https://discord.gg/WxZumR");
@@ -228,8 +234,14 @@ pub struct RichInvite {
/// When the invite was created.
pub created_at: DateTime<FixedOffset>,
/// A representation of the minimal amount of information needed about the
- /// guild being invited to.
- pub guild: InviteGuild,
+ /// [`Guild`] being invited to.
+ ///
+ /// This can be `None` if the invite is to a [`Group`] and not to a
+ /// Guild.
+ ///
+ /// [`Guild`]: ../guild/struct.Guild.html
+ /// [`Group`]: ../channel/struct.Group.html
+ pub guild: Option<InviteGuild>,
/// The user that created the invite.
pub inviter: User,
/// The maximum age of the invite in seconds, from when it was created.
@@ -301,14 +313,14 @@ impl RichInvite {
/// # kind: ChannelType::Text,
/// # },
/// # created_at: "2017-01-29T15:35:17.136000+00:00".parse().unwrap(),
- /// # guild: InviteGuild {
+ /// # guild: Some(InviteGuild {
/// # id: GuildId(2),
/// # icon: None,
/// # name: "baz".to_string(),
/// # splash_hash: None,
/// # text_channel_count: None,
/// # voice_channel_count: None,
- /// # },
+ /// # }),
/// # inviter: User {
/// # avatar: None,
/// # bot: false,