aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Perry <avaglir@gmail.com>2019-04-10 02:12:38 -0400
committerNathan Perry <avaglir@gmail.com>2019-04-10 02:12:38 -0400
commit54f729b3e2315e7d70f8daa01132cb233d302b1c (patch)
tree6c50ce3bfcf15dd844d9172fc8416bfe20f22cc9
parentf11a5ae72e7c3be7575761dde9669f2d93e67b59 (diff)
fix discord message length issues
-rw-r--r--src/commands/meme/history.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/commands/meme/history.rs b/src/commands/meme/history.rs
index dd88320..7a38325 100644
--- a/src/commands/meme/history.rs
+++ b/src/commands/meme/history.rs
@@ -308,6 +308,15 @@ pub fn query(_: &mut Context, msg: &Message, mut args: Args) -> Result<()> {
})
.collect::<Result<Vec<_>>>()?
.into_iter()
+ .scan(0, |state, line| {
+ *state = *state + line.len() + 1;
+
+ if *state < 2000 {
+ Some(line)
+ } else {
+ None
+ }
+ })
.join("\n");
if result.len() == 0 {