Skip to content

Commit 258f137

Browse files
committed
More use of read_list for stickers.
1 parent ff31788 commit 258f137

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/client.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -603,16 +603,8 @@ impl<S: Read + Write> Client<S> {
603603
/// List all stickers from a given object, identified by type and uri
604604
pub fn stickers(&mut self, typ: &str, uri: &str) -> Result<Vec<String>> {
605605
self.run_command("sticker list", (typ, uri))
606-
.and_then(|_| {
607-
self.read_pairs()
608-
.filter(|r| {
609-
r.as_ref()
610-
.map(|&(ref a, _)| *a == "sticker")
611-
.unwrap_or(true)
612-
})
613-
.map(|r| r.map(|(_, b)| b.splitn(2, '=').nth(1).map(|s| s.to_owned()).unwrap()))
614-
.collect()
615-
})
606+
.and_then(|_| self.read_list("sticker"))
607+
.map(|v| v.into_iter().map(|b| b.splitn(2, '=').nth(1).map(|s| s.to_owned()).unwrap()).collect())
616608
}
617609

618610
/// List all (file, sticker) pairs for sticker name and objects of given type

0 commit comments

Comments
 (0)