commit f0b9419745489e0b327cad3f86292e3efde2bd49
parent 18d8b9186a8f000c709783cc005144efc38a7e78
Author: Agastya Chandrakant <acagastya@outlook.com>
Date: Sun, 16 Aug 2020 03:11:16 +0530
Fixes #2, kill bot via PM
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/index.js b/index.js
@@ -12,9 +12,16 @@ ircClient.addListener("error", errorHandler);
ircClient.addListener("message", normalMsg);
-ircClient.addListener("pm", inviteHandler);
+ircClient.addListener("pm", pmHandler);
-function inviteHandler(sender, msg) {
+function handleKill(sender, msg) {
+ if(msg != "KILL") return;
+ if(!maintainer.includes(sender)) return;
+ process.abort();
+}
+
+function pmHandler(sender, msg) {
+ handleKill(sender, msg);
if (!msg.startsWith("#")) return;
channels.push(msg);
fs.writeFileSync(