aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-18 22:21:50 -0800
committerAustin Hellyer <[email protected]>2016-11-18 22:21:50 -0800
commit81b28b36146df8f9ec4a33744d43267e8030ec37 (patch)
treee73842d4a90e26e9325a0ef894d044a8471eda57 /src
parentAdd Context::set_game_name (diff)
downloadserenity-81b28b36146df8f9ec4a33744d43267e8030ec37.tar.xz
serenity-81b28b36146df8f9ec4a33744d43267e8030ec37.zip
Add GuildId::to_channel
Diffstat (limited to 'src')
-rw-r--r--src/model/id.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/model/id.rs b/src/model/id.rs
index ff236e1..8f925de 100644
--- a/src/model/id.rs
+++ b/src/model/id.rs
@@ -74,6 +74,7 @@ impl From<Emoji> for EmojiId {
}
impl GuildId {
+
/// Search the state for the guild.
#[cfg(feature="methods")]
pub fn find(&self) -> Option<LiveGuild> {
@@ -99,6 +100,13 @@ impl GuildId {
}
}
+ /// Returns this Id as a `ChannelId`, which is useful when needing to use
+ /// the guild Id to send a message to the default channel.
+ #[cfg(feature = "methods")]
+ pub fn to_channel(&self) -> ChannelId {
+ ChannelId(self.0)
+ }
+
/// Retrieves the guild's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.