Skip to content

Instantly share code, notes, and snippets.

@lovelaced
Last active June 8, 2020 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lovelaced/c63eea57ae87287768e73159db97ed51 to your computer and use it in GitHub Desktop.
Save lovelaced/c63eea57ae87287768e73159db97ed51 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Adjust homserver, room, and accesstoken to your particular setup
msgtype=m.text
homeserver="$2"
room="$3"
accesstoken="$4"
while true; do
rand=$(( ( RANDOM % 10 ) + 1 ))
echo "Sleeping $rand seconds..."
sleep $rand
echo "Sending message to server..."
echo "huh??" | curl -XPOST -d "$( jq -Rs --arg msgtype "$msgtype" '{$msgtype, body:., "m.labels": [ "#bot" ]}')" "https://$homeserver/_matrix/client/r0/rooms/%21$room:$homeserver/send/m.room.message?access_token=$accesstoken"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment