r27068 - in /scripts/KGB: debian/changelog server/KGB server/kgb.conf.sample
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Sat Nov 22 12:07:48 UTC 2008
Author: dmn
Date: Sat Nov 22 12:07:43 2008
New Revision: 27068
URL: http://svn.debian.org/wsvn/?sc=1&rev=27068
Log:
add support for a list of answers
Modified:
scripts/KGB/debian/changelog
scripts/KGB/server/KGB
scripts/KGB/server/kgb.conf.sample
Modified: scripts/KGB/debian/changelog
URL: http://svn.debian.org/wsvn/scripts/KGB/debian/changelog?rev=27068&op=diff
==============================================================================
--- scripts/KGB/debian/changelog (original)
+++ scripts/KGB/debian/changelog Sat Nov 22 12:07:43 2008
@@ -4,6 +4,7 @@
* Initial release. (Closes: #XXXXXX)
* make dependency on libpoe-component-irc-perl versioned >= 5.56, in which
NickServID plugin is first mentioned
+ * add support for a list of answers
[ MartÃn Ferrari ]
* server/KGB: move configuration reading and verification to a subroutine,
Modified: scripts/KGB/server/KGB
URL: http://svn.debian.org/wsvn/scripts/KGB/server/KGB?rev=27068&op=diff
==============================================================================
--- scripts/KGB/server/KGB (original)
+++ scripts/KGB/server/KGB Sat Nov 22 12:07:43 2008
@@ -85,7 +85,7 @@
$conf->{soap}{server_port} ||= 9999;
$conf->{soap}{server_addr} ||= "127.0.0.1";
$conf->{min_protocol_ver} = 1 unless(defined $conf->{min_protocol_ver});
- $conf->{smart_answer} ||= "Dam hasn't taught me to speak ÑÑÑÑкий. ÑÑ Ð·Ð½Ð°ÐµÑÑ ÑÑÑÑкий?";
+ $conf->{smart_answers} ||= [ "My master told me to not respond." ];
unless($KGB::supported_protos{$conf->{min_protocol_ver}}) {
die("Unrecognised min_protocol_ver (", $conf->{min_protocol_ver},
@@ -567,8 +567,9 @@
my $nick = (split /!/, $who)[0];
my $chan = $where->[0];
- my $msg = $KGB::config->{chanidx}{$chan}{smart_answer};
- $msg ||= $KGB::config->{smart_answer};
+ my $smart_answers = $KGB::config->{chanidx}{$chan}{smart_answers}
+ || $KGB::config->{smart_answers};
+ my $msg = $smart_answers->[(int(rand(scalar(@$smart_answers))))];
return undef unless($msg);
$kernel->post($sender => privmsg => $chan => $msg);
}
Modified: scripts/KGB/server/kgb.conf.sample
URL: http://svn.debian.org/wsvn/scripts/KGB/server/kgb.conf.sample?rev=27068&op=diff
==============================================================================
--- scripts/KGB/server/kgb.conf.sample (original)
+++ scripts/KGB/server/kgb.conf.sample Sat Nov 22 12:07:43 2008
@@ -10,7 +10,10 @@
# needs to be the same on the client
password: ~
# Some witty answer for people that talk to the bot
-#smart_answer: "I wont speak with you!"
+#smart_answers:
+# - "I wont speak with you!"
+# - "Do not disturb!"
+# - "Leave me alone, I am buzy!"
networks:
freenode:
nick: KGB
@@ -26,7 +29,10 @@
repos:
- foo
# Can also be set per-channel
- #smart_answer: "I'm in ur channel, watching ur commits!"
+ #smart_answers:
+ # - "I'm in ur channel, watching ur commits!"
+ # - "I am not listening"
+ # - "Shut up! I am buzy watching you."
pid_dir: /var/run/kgb-bot
# anything less is rejected
min_protocol_ver: 1
More information about the Pkg-perl-cvs-commits
mailing list