mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 04:19:27 +01:00
Added cc diff
command
This commit is contained in:
parent
0e783365d1
commit
36e48cb703
@ -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 => 421,
|
BUILD_REVISION => 422,
|
||||||
BUILD_DATE => "2013-08-16",
|
BUILD_DATE => "2013-08-22",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -180,6 +180,21 @@ if($code =~ m/^\s*show\s*$/i) {
|
|||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($code =~ m/^\s*diff\s*$/i) {
|
||||||
|
if($#last_code < 1) {
|
||||||
|
print "$nick: Not enough recent code to diff.\n"
|
||||||
|
} else {
|
||||||
|
use Text::WordDiff;
|
||||||
|
my $diff = word_diff \$last_code[1], \$last_code[0], { STYLE => 'MARKUP' };
|
||||||
|
$diff =~ s/<del>(.*?)<\/del><ins>(.*?)<\/ins>/<replaced `$1` with `$2`>/g;
|
||||||
|
$diff =~ s/<del>(.*?)<\/del>/<removed `$1`>/g;
|
||||||
|
$diff =~ s/<ins>(.*?)<\/ins>/<inserted `$1`>/g;
|
||||||
|
|
||||||
|
print "$nick: $diff\n";
|
||||||
|
}
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
my $got_run = undef;
|
my $got_run = undef;
|
||||||
|
|
||||||
if($code =~ m/^\s*(run|paste)\s*$/i) {
|
if($code =~ m/^\s*(run|paste)\s*$/i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user