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:
parent
4e8aa560e8
commit
b2544d9d5a
@ -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;
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user