1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 16:55:42 -04:00

Be less spammy in privmsg

This commit is contained in:
Ryan Voots 2019-05-06 20:28:18 -04:00
parent a01d80b90a
commit f6e0fbd506

View file

@ -558,9 +558,9 @@ sub plugin_output {
$copy->{name} = $said->{forwarding}; $copy->{name} = $said->{forwarding};
my $newtext = $said->{name} . " wanted you to know: ". $text; my $newtext = $said->{name} . " wanted you to know: ". $text;
$_[KERNEL]->yield(plugin_output => $copy, $newtext); $_[KERNEL]->yield(plugin_output => $copy, $newtext);
$said->{channel} = "*irc_msg"; $said->{channel} = "*irc_msg";
delete $said->{forwarding}; delete $said->{forwarding};
$_[KERNEL]->yield(plugin_output => $said, "Told ".$copy->{name}." about ".$text); $_[KERNEL]->yield(plugin_output => $said, "Told ".$copy->{name}." about ".$text);
return; return;
} }
@ -577,13 +577,13 @@ sub plugin_output {
# that receive multiple lines and those that don't.. # that receive multiple lines and those that don't..
$text = Encode::encode( "utf8", $text ); # set it up for raw bytes now $text = Encode::encode( "utf8", $text ); # set it up for raw bytes now
while( length $text ) { while( length $text ) {
my $substr = substr( $text, 0, 400, '' ); my $substr = substr( $text, 0, 200, '' );
$pci->yield( privmsg => $said->{name} => $substr ); $pci->yield( privmsg => $said->{name} => $substr );
# Try to avoid sending too many lines, since it may be annoying # Try to avoid sending too many lines, since it may be annoying
# and it tends to prevent the bot from sending other messages. # and it tends to prevent the bot from sending other messages.
last MESSAGES if $messages_sent++ > 60; last MESSAGES if $messages_sent++ > 5;
} }
} }
} }