diff options
| author | Illia <[email protected]> | 2016-12-07 20:09:04 +0200 |
|---|---|---|
| committer | zeyla <[email protected]> | 2016-12-07 10:09:04 -0800 |
| commit | 626ffb25af35f5b91a76fdccf6788382a1c39455 (patch) | |
| tree | da45ae770e06e68ea12910367a46b2d11aa90987 /src/model/id.rs | |
| parent | Improve Mentions, fix MessageBuilder (diff) | |
| download | serenity-626ffb25af35f5b91a76fdccf6788382a1c39455.tar.xz serenity-626ffb25af35f5b91a76fdccf6788382a1c39455.zip | |
Allow mentionable structs to be used as command arguments
Add EmojiIdentifier, allow User, UserId, Role, RoleId, EmojiIdentifier,
Channel and ChannelId to be used as arguments for commands and add more
parsing functions to utils
Diffstat (limited to 'src/model/id.rs')
| -rw-r--r-- | src/model/id.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/model/id.rs b/src/model/id.rs index 032e722..cbbd796 100644 --- a/src/model/id.rs +++ b/src/model/id.rs @@ -172,6 +172,14 @@ impl RoleId { } } +impl UserId { + /// Search the cache for the channel with the Id. + #[cfg(all(feature = "cache", feature = "methods"))] + pub fn find(&self) -> Option<User> { + CACHE.read().unwrap().get_user(*self).map(|x| x.clone()) + } +} + impl From<CurrentUser> for UserId { /// Gets the Id of a `CurrentUser` struct. fn from(current_user: CurrentUser) -> UserId { |