mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 04:02:37 +01:00
Add debugcontext
registry item for $stuff dumps
This commit is contained in:
parent
5d85573c6e
commit
51b1b25b16
@ -88,13 +88,14 @@ sub exists {
|
|||||||
|
|
||||||
sub interpreter {
|
sub interpreter {
|
||||||
my ($self, $stuff) = @_;
|
my ($self, $stuff) = @_;
|
||||||
#my ($from, $nick, $user, $host, $depth, $keyword, $arguments, $tonick, $unused, $referenced, $root_keyword) = @_;
|
|
||||||
my $result;
|
my $result;
|
||||||
|
|
||||||
|
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
$Data::Dumper::Sortkeys = 1;
|
$Data::Dumper::Sortkeys = 1;
|
||||||
$self->{pbot}->{logger}->log("Commands::interpreter\n");
|
$self->{pbot}->{logger}->log("Commands::interpreter\n");
|
||||||
$self->{pbot}->{logger}->log(Dumper $stuff);
|
$self->{pbot}->{logger}->log(Dumper $stuff);
|
||||||
|
}
|
||||||
|
|
||||||
my $admin = $self->{pbot}->{admins}->loggedin($stuff->{from}, "$stuff->{nick}!$stuff->{user}\@$stuff->{host}");
|
my $admin = $self->{pbot}->{admins}->loggedin($stuff->{from}, "$stuff->{nick}!$stuff->{user}\@$stuff->{host}");
|
||||||
my $level = defined $admin ? $admin->{level} : 0;
|
my $level = defined $admin ? $admin->{level} : 0;
|
||||||
|
@ -44,10 +44,16 @@ sub initialize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub execute_module {
|
sub execute_module {
|
||||||
# my ($self, $from, $tonick, $nick, $user, $host, $command, $root_channel, $root_keyword, $keyword, $arguments, $preserve_whitespace, $referenced) = @_;
|
|
||||||
my ($self, $stuff) = @_;
|
my ($self, $stuff) = @_;
|
||||||
my $text;
|
my $text;
|
||||||
|
|
||||||
|
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
||||||
|
use Data::Dumper;
|
||||||
|
$Data::Dumper::Sortkeys = 1;
|
||||||
|
$self->{pbot}->{logger}->log("FML::execute_module\n");
|
||||||
|
$self->{pbot}->{logger}->log(Dumper $stuff);
|
||||||
|
}
|
||||||
|
|
||||||
$stuff->{arguments} = "" if not defined $stuff->{arguments};
|
$stuff->{arguments} = "" if not defined $stuff->{arguments};
|
||||||
|
|
||||||
my @factoids = $self->{pbot}->{factoids}->find_factoid($stuff->{from}, $stuff->{keyword}, undef, 2, 2);
|
my @factoids = $self->{pbot}->{factoids}->find_factoid($stuff->{from}, $stuff->{keyword}, undef, 2, 2);
|
||||||
@ -174,7 +180,10 @@ sub execute_module {
|
|||||||
sub module_pipe_reader {
|
sub module_pipe_reader {
|
||||||
my ($self, $buf) = @_;
|
my ($self, $buf) = @_;
|
||||||
|
|
||||||
my $stuff = decode_json $buf or return;
|
my $stuff = decode_json $buf or do {
|
||||||
|
$self->{pbot}->{logger}->log("Failed to decode bad json: [$buf]\n");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
if (not defined $stuff->{result} or not length $stuff->{result}) {
|
if (not defined $stuff->{result} or not length $stuff->{result}) {
|
||||||
$self->{pbot}->{logger}->log("No result from module.\n");
|
$self->{pbot}->{logger}->log("No result from module.\n");
|
||||||
|
@ -715,16 +715,14 @@ sub execute_code_factoid {
|
|||||||
|
|
||||||
sub interpreter {
|
sub interpreter {
|
||||||
my ($self, $stuff) = @_;
|
my ($self, $stuff) = @_;
|
||||||
=cut
|
|
||||||
my $self = shift;
|
|
||||||
my ($from, $nick, $user, $host, $depth, $keyword, $arguments, $tonick, $ref_from, $referenced, $root_keyword) = @_;
|
|
||||||
=cut
|
|
||||||
my $pbot = $self->{pbot};
|
my $pbot = $self->{pbot};
|
||||||
|
|
||||||
|
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
$Data::Dumper::Sortkeys = 1;
|
$Data::Dumper::Sortkeys = 1;
|
||||||
$self->{pbot}->{logger}->log("Factoids::interpreter\n");
|
$self->{pbot}->{logger}->log("Factoids::interpreter\n");
|
||||||
$self->{pbot}->{logger}->log(Dumper $stuff);
|
$self->{pbot}->{logger}->log(Dumper $stuff);
|
||||||
|
}
|
||||||
|
|
||||||
#$self->{pbot}->{logger}->log("enter factoid interpreter [$keyword][" . (defined $arguments ? $arguments : '') . "] referenced = $referenced\n");
|
#$self->{pbot}->{logger}->log("enter factoid interpreter [$keyword][" . (defined $arguments ? $arguments : '') . "] referenced = $referenced\n");
|
||||||
return undef if not length $stuff->{keyword} or $stuff->{interpret_depth} > $self->{pbot}->{registry}->get_value('interpreter', 'max_recursion');
|
return undef if not length $stuff->{keyword} or $stuff->{interpret_depth} > $self->{pbot}->{registry}->get_value('interpreter', 'max_recursion');
|
||||||
@ -855,13 +853,14 @@ sub interpreter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub handle_action {
|
sub handle_action {
|
||||||
# my ($self, $nick, $user, $host, $from, $channel, $root_keyword, $keyword, $arguments, $action, $tonick, $depth, $referenced, $ref_from, $original_keyword) = @_;
|
|
||||||
my ($self, $stuff, $action) = @_;
|
my ($self, $stuff, $action) = @_;
|
||||||
|
|
||||||
|
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
$Data::Dumper::Sortkeys = 1;
|
$Data::Dumper::Sortkeys = 1;
|
||||||
$self->{pbot}->{logger}->log("Factoids::handle_action [$action]\n");
|
$self->{pbot}->{logger}->log("Factoids::handle_action [$action]\n");
|
||||||
$self->{pbot}->{logger}->log(Dumper $stuff);
|
$self->{pbot}->{logger}->log(Dumper $stuff);
|
||||||
|
}
|
||||||
|
|
||||||
return "" if not length $action;
|
return "" if not length $action;
|
||||||
|
|
||||||
|
@ -203,17 +203,18 @@ sub process_line {
|
|||||||
|
|
||||||
sub interpret {
|
sub interpret {
|
||||||
my ($self, $stuff) = @_;
|
my ($self, $stuff) = @_;
|
||||||
# my ($from, $nick, $user, $host, $depth, $command, $tonick, $referenced, $root_keyword) = @_;
|
|
||||||
my ($keyword, $arguments) = ("", "");
|
my ($keyword, $arguments) = ("", "");
|
||||||
my $text;
|
my $text;
|
||||||
my $pbot = $self->{pbot};
|
my $pbot = $self->{pbot};
|
||||||
|
|
||||||
$pbot->{logger}->log("=== Enter interpret_command: [" . (defined $stuff->{from} ? $stuff->{from} : "(undef)") . "][$stuff->{nick}!$stuff->{user}\@$stuff->{host}][$stuff->{interpret_depth}][$stuff->{command}]\n");
|
$pbot->{logger}->log("=== Enter interpret_command: [" . (defined $stuff->{from} ? $stuff->{from} : "(undef)") . "][$stuff->{nick}!$stuff->{user}\@$stuff->{host}][$stuff->{interpret_depth}][$stuff->{command}]\n");
|
||||||
|
|
||||||
|
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
$Data::Dumper::Sortkeys = 1;
|
$Data::Dumper::Sortkeys = 1;
|
||||||
$self->{pbot}->{logger}->log("Interpreter::interpret\n");
|
$self->{pbot}->{logger}->log("Interpreter::interpret\n");
|
||||||
$self->{pbot}->{logger}->log(Dumper $stuff);
|
$self->{pbot}->{logger}->log(Dumper $stuff);
|
||||||
|
}
|
||||||
|
|
||||||
return "Too many levels of recursion, aborted." if(++$stuff->{interpret_depth} > $self->{pbot}->{registry}->get_value('interpreter', 'max_recursion'));
|
return "Too many levels of recursion, aborted." if(++$stuff->{interpret_depth} > $self->{pbot}->{registry}->get_value('interpreter', 'max_recursion'));
|
||||||
|
|
||||||
@ -335,14 +336,15 @@ sub truncate_result {
|
|||||||
|
|
||||||
sub handle_result {
|
sub handle_result {
|
||||||
my ($self, $stuff, $result) = @_;
|
my ($self, $stuff, $result) = @_;
|
||||||
# my ($self, $from, $nick, $user, $host, $text, $command, $result, $checkflood, $preserve_whitespace) = @_;
|
|
||||||
|
|
||||||
$stuff->{preserve_whitespace} = 0 if not defined $stuff->{preserve_whitespace};
|
$stuff->{preserve_whitespace} = 0 if not defined $stuff->{preserve_whitespace};
|
||||||
|
|
||||||
|
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
$Data::Dumper::Sortkeys = 1;
|
$Data::Dumper::Sortkeys = 1;
|
||||||
$self->{pbot}->{logger}->log("Interpreter::handle_result [$result]\n");
|
$self->{pbot}->{logger}->log("Interpreter::handle_result [$result]\n");
|
||||||
$self->{pbot}->{logger}->log(Dumper $stuff);
|
$self->{pbot}->{logger}->log(Dumper $stuff);
|
||||||
|
}
|
||||||
|
|
||||||
$result = $stuff->{result} if not defined $result;
|
$result = $stuff->{result} if not defined $result;
|
||||||
|
|
||||||
@ -462,13 +464,14 @@ sub handle_result {
|
|||||||
|
|
||||||
sub output_result {
|
sub output_result {
|
||||||
my ($self, $stuff) = @_;
|
my ($self, $stuff) = @_;
|
||||||
# my ($self, $from, $nick, $user, $host, $command, $line, $checkflood) = @_;
|
|
||||||
my ($pbot, $botnick) = ($self->{pbot}, $self->{pbot}->{registry}->get_value('irc', 'botnick'));
|
my ($pbot, $botnick) = ($self->{pbot}, $self->{pbot}->{registry}->get_value('irc', 'botnick'));
|
||||||
|
|
||||||
|
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
$Data::Dumper::Sortkeys = 1;
|
$Data::Dumper::Sortkeys = 1;
|
||||||
$self->{pbot}->{logger}->log("Interpreter::output_result\n");
|
$self->{pbot}->{logger}->log("Interpreter::output_result\n");
|
||||||
$self->{pbot}->{logger}->log(Dumper $stuff);
|
$self->{pbot}->{logger}->log(Dumper $stuff);
|
||||||
|
}
|
||||||
|
|
||||||
my $line = $stuff->{line};
|
my $line = $stuff->{line};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user