diff options
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 $? +} + + + |