summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-02-16 22:53:24 -0600
committerJesse Luehrs <doy@tozt.net>2012-02-16 22:58:03 -0600
commitcc3ec78d63fac61603e3fa197c455cc4e825d798 (patch)
tree6267ec1e48bd36fbb2a0a81602a7ab4d67bfeda1
parent2f7b660dd95086ebf68de8a795fa4abd643f33e2 (diff)
downloadbot-flowdock-irc-cc3ec78d63fac61603e3fa197c455cc4e825d798.tar.gz
bot-flowdock-irc-cc3ec78d63fac61603e3fa197c455cc4e825d798.zip
make sure we properly truncate irc messages
-rw-r--r--lib/Bot/Flowdock/IRC.pm15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/Bot/Flowdock/IRC.pm b/lib/Bot/Flowdock/IRC.pm
index 878e235..832fe24 100644
--- a/lib/Bot/Flowdock/IRC.pm
+++ b/lib/Bot/Flowdock/IRC.pm
@@ -6,6 +6,7 @@ use JSON;
use List::MoreUtils 'any';
use Net::Flowdock 0.03;
use Net::Flowdock::Stream;
+use String::Truncate 'elide';
extends 'Bot::BasicBot';
@@ -224,17 +225,15 @@ sub _say_to_channel {
if (defined($from)) {
$body = $params{emoted} ? "* $from $body" : "<$from> $body";
- $self->say(
- channel => ($self->channels)[0],
- body => $body,
- );
}
else {
- $self->say(
- channel => ($self->channels)[0],
- body => "-!- $body",
- );
+ $body = "-!- $body";
}
+
+ $self->say(
+ channel => ($self->channels)[0],
+ body => elide($body, 350, { at_space => 1 }),
+ );
}
sub _say_to_flowdock {