jenkins-bot has submitted this change and it was merged.

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(-)

Approvals:
  Luke081515: Looks good to me, approved
  jenkins-bot: Verified



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..ace5d22
--- /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);
+}
+?>
\ No newline at end of file
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: merged
Gerrit-Change-Id: Ica5f186c7d24921066311ebb848e3d12a3234e9f
Gerrit-PatchSet: 2
Gerrit-Project: labs/tools/Luke081515IRCBot
Gerrit-Branch: master
Gerrit-Owner: Luke081515 <[email protected]>
Gerrit-Reviewer: Luke081515 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to