diff options
author | Linnea Gräf <nea@nea.moe> | 2024-10-06 17:38:27 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-10-06 17:38:27 +0200 |
commit | 788470b8fd1e645d41d456183443fb4f4534c511 (patch) | |
tree | 3507d63da09752a273db0a70a427eaf1271df6ee /data.sh | |
parent | 12d3727fa5308149953973a38029a2344a13719d (diff) | |
download | forgebot-788470b8fd1e645d41d456183443fb4f4534c511.tar.gz forgebot-788470b8fd1e645d41d456183443fb4f4534c511.tar.bz2 forgebot-788470b8fd1e645d41d456183443fb4f4534c511.zip |
snapshot Sun Oct 6 05:38:27 PM CEST 2024
Diffstat (limited to 'data.sh')
-rw-r--r-- | data.sh | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -0,0 +1,31 @@ +export FORGEBOT_DATA_DIR="forgebotdata" +mkdir -p "$FORGEBOT_DATA_DIR" + +list_watchers() { + # Usage: list_watchers <minecraft uuid> + cat "$FORGEBOT_DATA_DIR/$1" +} + +find_watched_accounts() { + # Usage: find_watched_accounts <discord uuid> + grep -lr "$1" "$FORGEBOT_DATA_DIR" | sed 's|.*/||' +} + +add_watched_account() { + # Usage: add_watched_account <discord uuid> <minecraft uuid> + echo "$1" >> "$FORGEBOT_DATA_DIR/$2" +} + +remove_watched_account() { + # Usage: remove_watched_account <discord uuid> <minecraft uuid> + sed -i "/$1/d" "$FORGEBOT_DATA_DIR/$2" +} + +has_watched_account() { + # Usage: has_watched_account <discord uuid> <minecraft uuid> + grep "$1" "$FORGEBOT_DATA_DIR/$2" >/dev/null + return $? +} + + + |