aboutsummaryrefslogtreecommitdiff
path: root/example/simple.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 /example/simple.sh
parent65cbc9069e15f7f77a0497395a7796906b8ade9a (diff)
downloadatrocity-1083db296869fdf6cbb9b4ac1739b62f21428920.tar.gz
atrocity-1083db296869fdf6cbb9b4ac1739b62f21428920.tar.bz2
atrocity-1083db296869fdf6cbb9b4ac1739b62f21428920.zip
More WIP
Diffstat (limited to 'example/simple.sh')
-rwxr-xr-xexample/simple.sh24
1 files changed, 21 insertions, 3 deletions
diff --git a/example/simple.sh b/example/simple.sh
index c90c451..a756ee4 100755
--- a/example/simple.sh
+++ b/example/simple.sh
@@ -1,12 +1,30 @@
#!/usr/bin/env bash
+source "$(dirname -- "$0")"/env.sh
source "$(dirname -- "$0")"/../load.sh
atrocity_debug Simple example loaded
+atrocity_on_GUILD_CREATE() {
+ atrocity_debug "Guild: $(echo "$1" | jq -r .name)"
+}
+atrocity_on_unknown() {
+ atrocity_debug "Unknown event $1"
+}
+atrocity_on_MESSAGE_CREATE() {
+ local content
+ local channel
+ content="$(echo "$1" | jq -r .content)"
+ channel="$(echo "$1" | jq -r .channel_id)"
-export ATROCITY_TOKEN="MzEyMjU2ODcxMTc0MTExMjMz.GPe_v6.4Acwm7tje3sMEvUu05NPyQrZalh8knTIHPgLmk"
+ if [[ "$(echo "$1" | jq -r .author.bot)" = "true" ]]; then
+ return
+ fi
+ atrocity_debug "Found message with content $content"
-atrocity_dispatch() {
- echo "Dispatching $1"
+ case "$content" in
+ \!ping)
+ atrocity_rest POST /channels/"$channel"/messages '{"content": "Pong", "embeds": [{"title": "Pong", "description": "You have been ponginated"}]}'
+ ;;
+ esac
}
atrocity_connect