summaryrefslogtreecommitdiffstats
path: root/Reaktor/commands
diff options
context:
space:
mode:
Diffstat (limited to 'Reaktor/commands')
-rwxr-xr-xReaktor/commands/caps5
-rwxr-xr-xReaktor/commands/identify22
-rwxr-xr-xReaktor/commands/tell-on_join19
-rwxr-xr-xReaktor/commands/tell-on_privmsg17
l---------Reaktor/commands/visit-page1
-rwxr-xr-xReaktor/commands/whatweb2
6 files changed, 63 insertions, 3 deletions
diff --git a/Reaktor/commands/caps b/Reaktor/commands/caps
index c47319f5..ac8cc66d 100755
--- a/Reaktor/commands/caps
+++ b/Reaktor/commands/caps
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
import imp
import os
@@ -9,4 +9,5 @@ def load_config(filename):
return imp.load_module(modname, file, pathname, description)
config = load_config(os.environ['config_filename'])
-print(' '.join(filter(None,[ x.get('capname',None) for x in config.commands])))
+print('Private: '+' '.join(filter(None,[ x.get('capname',None) for x in config.commands])))
+print('Public: '+' '.join(filter(None,[ x.get('capname',None) for x in config.public_commands])))
diff --git a/Reaktor/commands/identify b/Reaktor/commands/identify
new file mode 100755
index 00000000..c2fb2c58
--- /dev/null
+++ b/Reaktor/commands/identify
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import imp
+import os,sys
+
+def load_config(filename):
+ dirname = os.path.dirname(filename)
+ modname, ext = os.path.splitext(os.path.basename(filename))
+ file, pathname, description = imp.find_module(modname, [ dirname ])
+ return imp.load_module(modname, file, pathname, description)
+
+config = load_config(os.environ['config_filename'])
+
+with open(config.admin_file) as f:
+ for line in f:
+ nick,secret = line.split()
+ if sys.argv[1] == secret:
+ print("identified you as %s!"%nick)
+ with open(config.auth_file,'a+') as g:
+ g.write(os.environ['_prefix'] +"\n")
+ sys.exit(0)
+
+print("unable to identify you, sorry")
diff --git a/Reaktor/commands/tell-on_join b/Reaktor/commands/tell-on_join
new file mode 100755
index 00000000..2dbff41a
--- /dev/null
+++ b/Reaktor/commands/tell-on_join
@@ -0,0 +1,19 @@
+#! /bin/sh
+set -euf
+
+# require flock from util-linux
+if test "${FLOCK-}" != "$state_file"; then
+ exec env FLOCK="$state_file" flock "$state_file" "$0" "$@"
+fi
+
+to="$_from"
+
+# print messages
+sed -n '/^'"$to"' /{
+ s/^\([^ ]\+\) \([^ ]\+\) <\([^>]\+\)> \(.*\)/\1: \4 2-- \2, \3/p
+}' "$state_file"
+
+# delete messages
+sed -i '/^'"$to"' /{
+ d
+}' "$state_file"
diff --git a/Reaktor/commands/tell-on_privmsg b/Reaktor/commands/tell-on_privmsg
new file mode 100755
index 00000000..5d0aff41
--- /dev/null
+++ b/Reaktor/commands/tell-on_privmsg
@@ -0,0 +1,17 @@
+#! /bin/sh
+set -euf
+
+# require flock from util-linux
+if test "${FLOCK-}" != "$state_file"; then
+ exec env FLOCK="$state_file" flock "$state_file" "$0" "$@"
+fi
+
+from="$_prefix"
+to="$1"; shift
+msg="$*"
+date=$(date)
+
+# TODO tell now, if already joined
+printf '%s %s <%s> %s\n' "$to" "$from" "$date" "$msg" >> "$state_file"
+
+echo 'Consider it noted.' # that's what lambdabot says...
diff --git a/Reaktor/commands/visit-page b/Reaktor/commands/visit-page
new file mode 120000
index 00000000..8723336b
--- /dev/null
+++ b/Reaktor/commands/visit-page
@@ -0,0 +1 @@
+../repos/view-website/runner.sh \ No newline at end of file
diff --git a/Reaktor/commands/whatweb b/Reaktor/commands/whatweb
index afe20360..68f8aa38 100755
--- a/Reaktor/commands/whatweb
+++ b/Reaktor/commands/whatweb
@@ -4,4 +4,4 @@ here=$(dirname `readlink -f $0`)
whatweb_bin="$here/../repos/whatweb/whatweb"
[ ! -e "$whatweb_bin" ] && echo "!! Whatweb app does not exist" && exit 1
[ -z "${1:-}" ] && echo "!! no host given" && exit 1
-exec $whatweb_bin -a 3 "$1" 2>&1
+exec $whatweb_bin --user-agent="Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0" -a 3 "$1" 2>&1