aboutsummaryrefslogtreecommitdiff
path: root/connect.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 /connect.sh
parent65cbc9069e15f7f77a0497395a7796906b8ade9a (diff)
downloadatrocity-1083db296869fdf6cbb9b4ac1739b62f21428920.tar.gz
atrocity-1083db296869fdf6cbb9b4ac1739b62f21428920.tar.bz2
atrocity-1083db296869fdf6cbb9b4ac1739b62f21428920.zip
More WIP
Diffstat (limited to 'connect.sh')
-rw-r--r--connect.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/connect.sh b/connect.sh
index 73d45ba..40b66da 100644
--- a/connect.sh
+++ b/connect.sh
@@ -73,14 +73,12 @@ atrocity_loop() {
atrocity_debug "Atrocity loop started before connection has been set up"
exit 1
fi
- atrocity_debug "Loop started"
+ atrocity_debug "Read loop started"
while true; do
local line
local operator
- atrocity_debug "Trying to read line"
if read -r line; then
- atrocity_debug "Reading message from discord: $line"
-
+ echo "$line" >>raw_receive.log
printf %s "$line" | jq 'if .s then .s else '"$(atrocity_sequence_get)"' end' >"$ATROCITY_SESSION"/sequence
operator="$(printf %s "$line" | jq .op)"
case "$operator" in
@@ -91,10 +89,10 @@ atrocity_loop() {
10) # Hello
atrocity_debug "Sending hello"
echo "$(($(printf "%s" "$line" | jq -r .d.heartbeat_interval) / 1000))" >"$ATROCITY_SESSION"/heartbeat-interval
- atrocity_gateway_send_raw '{"op":2,"d":{"token":"'$ATROCITY_TOKEN'", "properties":{"os":"linux","browser":"bash","device":"bash"},"presence":{"status":"online","afk":false, "activities":[{"type":0,"name":"Being coded in Bash"}]}, "intents":33287}}'
+ atrocity_gateway_send_raw '{"op":2,"d":{"token":"'$ATROCITY_TOKEN'", "properties":{"os":"linux","browser":"bash","device":"bash"},"presence":{"status":"online","afk":false, "activities":[{"type":0,"name":"Being coded in Bash"}]}, "intents":4609}}'
;;
0) # Dispatch
- atrocity_dispatch "$line"
+ atrocity_on_dispatch "$line"
;;
1) # Heartbeat
atrocity_heartbeat