summaryrefslogtreecommitdiffstats
path: root/modules/ping.bash
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ping.bash')
-rw-r--r--modules/ping.bash17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/ping.bash b/modules/ping.bash
new file mode 100644
index 0000000..ece6a1f
--- /dev/null
+++ b/modules/ping.bash
@@ -0,0 +1,17 @@
+# modules/ping.bash
+#
+# Responds to IRC PINGs.
+
+
+if [ -z "$IRCBOT_MODULE" ]; then
+ printf "error: %s is a module for ircbot.bash and should not be run separately\n" "$0"
+ exit 1
+fi
+
+
+# respond to PINGs
+on_readmsg() { # args: $1 - raw message, $2 - source, $3 - command, $4... - args
+ if [[ $3 == PING ]]; then
+ sendmsg PONG "${@:4}"
+ fi
+}