3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-01-11 20:42:38 +01:00

compiler_vm: remember last output per channel and print "Same output." if the current output matches the last output

This commit is contained in:
Pragmatic Software 2014-04-02 23:48:43 +00:00
parent 4e8aa560e8
commit b2544d9d5a
2 changed files with 20 additions and 2 deletions

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 537, BUILD_REVISION => 538,
BUILD_DATE => "2014-04-01", BUILD_DATE => "2014-04-02",
}; };
1; 1;

View File

@ -1142,4 +1142,22 @@ if(defined $got_paste or (defined $got_run and $got_run eq "paste")) {
exit 0; exit 0;
} }
if(open FILE, "< history/$channel.last-output") {
my $last_output;
while(my $line = <FILE>) {
$last_output .= $line;
}
close FILE;
if($last_output eq $output) {
print "$nick: Same output.\n";
exit 0;
}
}
print "$nick: $output\n"; print "$nick: $output\n";
open FILE, "> history/$channel.last-output" or die "Couldn't open $channel.last-output: $!";
print FILE "$output";
close FILE;