Luke081515 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/284355
Change subject: Implement hook "kick"
......................................................................
Implement hook "kick"
Allows the bot to kick people by the !kick command. Indispensable for a quiet
channel! Owner only at the moment.
Change-Id: Ica5f186c7d24921066311ebb848e3d12a3234e9f
---
M IRCBot.php
A bot_functions/kick.php
M bot_functions/kicked.php
3 files changed, 11 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/labs/tools/Luke081515IRCBot
refs/changes/55/284355/1
diff --git a/IRCBot.php b/IRCBot.php
index 7b4e5ca..22e8f06 100644
--- a/IRCBot.php
+++ b/IRCBot.php
@@ -14,7 +14,7 @@
$log_format = "d.m H:i";
$info["owner"] = $owner;
$info["commands"] = $c . "info, " . $c . "urlencode " . $c . "urldecode";
-$info["admin_commands"] = $c . "quit, " . $c . "nick, ";
+$info["admin_commands"] = $c . "quit, " . $c . "nick, " . $c . "kick";
// Config end
$dir = "bot_functions/";
diff --git a/bot_functions/kick.php b/bot_functions/kick.php
new file mode 100644
index 0000000..f2b0368
--- /dev/null
+++ b/bot_functions/kick.php
@@ -0,0 +1,9 @@
+<?php
+$bot->add_privmsg_hook($c . "kick", "ircbot_kick");
+function ircbot_kick($object, $params, $prefix, $channel) {
+ global $owner;
+ $nick = IRC::get_nick($prefix);
+ if ($nick == $owner) {
+ $object->kick($channel . " " . $params);
+}
+?>
diff --git a/bot_functions/kicked.php b/bot_functions/kicked.php
index 4bfa31f..ad73127 100644
--- a/bot_functions/kicked.php
+++ b/bot_functions/kicked.php
@@ -1,5 +1,5 @@
<?php
-$bot->add_hook("KICK", "ircbot_kicked");
+$bot->add_hook("KICKED", "ircbot_kicked");
function ircbot_kicked($object, $command, $params, $prefix) {
global $channel;
--
To view, visit https://gerrit.wikimedia.org/r/284355
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica5f186c7d24921066311ebb848e3d12a3234e9f
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/Luke081515IRCBot
Gerrit-Branch: master
Gerrit-Owner: Luke081515 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits