From cc3ec78d63fac61603e3fa197c455cc4e825d798 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 16 Feb 2012 22:53:24 -0600 Subject: make sure we properly truncate irc messages --- lib/Bot/Flowdock/IRC.pm | 15 +++++++-------- 1 file 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 { -- cgit v1.2.3-54-g00ecf