summaryrefslogtreecommitdiff
path: root/data.sh
diff options
context:
space:
mode:
Diffstat (limited to 'data.sh')
-rw-r--r--data.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/data.sh b/data.sh
new file mode 100644
index 0000000..3a16c5b
--- /dev/null
+++ b/data.sh
@@ -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 $?
+}
+
+
+