diff options
| -rw-r--r-- | src/model/channel.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs index e994d4b..852a1d0 100644 --- a/src/model/channel.rs +++ b/src/model/channel.rs @@ -883,6 +883,15 @@ impl PublicChannel { } } + /// Attempts to find this channel's guild in the State. + /// + /// **Note**: Right now this performs a clone of the guild. This will be + /// optimized in the future. + #[cfg(all(feature = "methods", feature = "state"))] + pub fn guild(&self) -> Option<LiveGuild> { + STATE.lock().unwrap().find_guild(self.guild_id).cloned() + } + /// Return a [`Mention`] which will link to this channel. /// /// [`Mention`]: struct.Mention.html |