Skip to content

Instantly share code, notes, and snippets.

@fafrd
fafrd / craftlogger.sh
Created April 28, 2021 00:13
simple minecraft join/leave discord webhook
#!/bin/bash
webhook="https://discord.com/api/webhooks/YOUR_WEBHOOK_HERE"
post_shit () {
echo $*
join=$(echo $* | grep join | grep -v "INFO]: <" | sed "s/.*INFO]: //g" | sed "s/ joined the game.*//g" | sed "s/_/\\\\\\\\_/g")
left=$(echo $* | grep left | grep -v "INFO]: <" | sed "s/.*INFO]: //g" | sed "s/ left the game.*//g" | sed "s/_/\\\\\\\\_/g")
[ ! -z "$join" ] && ./discord.sh --webhook-url=$webhook --text "_${join} has joined the minecraft server_"

Keybase proof

I hereby claim:

  • I am fafrd on github.
  • I am fafrd (https://keybase.io/fafrd) on keybase.
  • I have a public key ASDsU3lcldxKav4cgozGqV9JvBwek97Js__UVZdpupAiowo

To claim this, I am signing this object:

0x7002dc0b933fce55e5bfa5d67f5c9807f03e4856
0x8c0fb1412d19a37031a69f25f1adbeb1ff74b8a8
0xa24b0b51941f1d2b92fbf9dd4a3887e28587f99c