aboutsummaryrefslogtreecommitdiff
path: root/events.sh
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-05-12 16:07:15 +0200
committerLinnea Gräf <nea@nea.moe>2024-05-12 16:07:15 +0200
commit1083db296869fdf6cbb9b4ac1739b62f21428920 (patch)
treec65b2597734aa3cf963f546f0ec90c890c4203bb /events.sh
parent65cbc9069e15f7f77a0497395a7796906b8ade9a (diff)
downloadatrocity-1083db296869fdf6cbb9b4ac1739b62f21428920.tar.gz
atrocity-1083db296869fdf6cbb9b4ac1739b62f21428920.tar.bz2
atrocity-1083db296869fdf6cbb9b4ac1739b62f21428920.zip
More WIP
Diffstat (limited to 'events.sh')
-rw-r--r--events.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/events.sh b/events.sh
new file mode 100644
index 0000000..6704def
--- /dev/null
+++ b/events.sh
@@ -0,0 +1,22 @@
+atrocity_on_dispatch() {
+ local event
+ event="$(printf '%s' "$1" | jq -r .t)"
+ atrocity_on_event "$event" "$(printf '%s' "$1" | jq .d)"
+}
+
+atrocity_on_event() {
+ atrocity_on_default_event "$1" "$2"
+}
+atrocity_on_default_event() {
+ local handler
+ handler="atrocity_on_$1"
+ if declare -F "$handler" >/dev/null; then
+ "$handler" "$2"
+ else
+ atrocity_on_unknown "$1" "$2"
+ fi
+}
+
+atrocity_on_unknown() {
+ noop
+}