From 34c0e63971b873e3cd278c53d3071999f8d12e9f Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Fri, 4 Feb 2011 14:34:51 -0700 Subject: [PATCH] If fantasy HELP is used, only display fantasy commands, if private HELP is used, only display private commands. --- doc/CHANGELOG | 2 ++ src/Core/IRC.pm | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index c47aa6b..0997c65 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,8 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev ================================================================== + * If fantasy HELP is used, only display fantasy commands, if + private HELP is used, only display private commands. * Fixed cmd_add syntax. Correct format: name, level, short help, full help, callback. * Added core command HELP. diff --git a/src/Core/IRC.pm b/src/Core/IRC.pm index 93239a7..fbb68f6 100644 --- a/src/Core/IRC.pm +++ b/src/Core/IRC.pm @@ -255,7 +255,16 @@ sub cmd_help # No command specified. List commands. my $cmdlist = ''; foreach (sort keys %API::Std::CMDS) { - $cmdlist .= ", \002".uc($_)."\002"; + if (defined $data{chan}) { + if ($API::Std::CMDS{$_}{lvl} == 0 or $API::Std::CMDS{$_}{lvl} == 2) { + $cmdlist .= ", \002".uc($_)."\002"; + } + } + else { + if ($API::Std::CMDS{$_}{lvl} == 1 or $API::Std::CMDS{$_}{lvl} == 2) { + $cmdlist .= ", \002".uc($_)."\002"; + } + } } $cmdlist = substr($cmdlist, 2);