summaryrefslogtreecommitdiff
path: root/data.sh
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-10-06 17:38:27 +0200
committerLinnea Gräf <nea@nea.moe>2024-10-06 17:38:27 +0200
commit788470b8fd1e645d41d456183443fb4f4534c511 (patch)
tree3507d63da09752a273db0a70a427eaf1271df6ee /data.sh
parent12d3727fa5308149953973a38029a2344a13719d (diff)
downloadforgebot-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.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 $?
+}
+
+
+