aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/channel_id.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-10-16 14:39:57 +0200
committeracdenisSK <[email protected]>2017-10-16 14:40:10 +0200
commitc7aa27dbb64e64d70c7f13725c79017c4bba1c95 (patch)
tree616900c9194b5ec40abd6314239fec201ec3e2df /src/model/channel/channel_id.rs
parentUpdate 0.4.2's Cargo.toml version to 0.4.2 itself (#196) (diff)
downloadserenity-c7aa27dbb64e64d70c7f13725c79017c4bba1c95.tar.xz
serenity-c7aa27dbb64e64d70c7f13725c79017c4bba1c95.zip
defer to `delete_message` if there's just one message to delete
Diffstat (limited to 'src/model/channel/channel_id.rs')
-rw-r--r--src/model/channel/channel_id.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/model/channel/channel_id.rs b/src/model/channel/channel_id.rs
index f728191..2e415dc 100644
--- a/src/model/channel/channel_id.rs
+++ b/src/model/channel/channel_id.rs
@@ -122,10 +122,14 @@ impl ChannelId {
.into_iter()
.map(|message_id| message_id.as_ref().0)
.collect::<Vec<u64>>();
+
+ if ids.len() == 1 {
+ self.delete_message(ids[0])
+ } else {
+ let map = json!({ "messages": ids });
- let map = json!({ "messages": ids });
-
- http::delete_messages(self.0, &map)
+ http::delete_messages(self.0, &map)
+ }
}
/// Deletes all permission overrides in the channel from a member or role.