aboutsummaryrefslogtreecommitdiff
path: root/events.sh
blob: 6704deff623bf983a57bbb86c50bca923c03283c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
}