summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Dockerfile2
-rwxr-xr-xforgebot.sh4
-rwxr-xr-xforgebot_proper.sh3
m---------repo0
5 files changed, 7 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index e46761e..ee194af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@ env.sh
notificationdata
messagedata
forgebotdata
+repo
diff --git a/Dockerfile b/Dockerfile
index a8b68c8..66872aa 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
FROM alpine
-RUN apk add --no-cache websocat bash jq grep curl
+RUN apk add --no-cache websocat bash jq grep curl git
COPY ./ /app/forgebot/
WORKDIR "/app/forgebot"
ENTRYPOINT ["/app/forgebot/forgebot_proper.sh"]
diff --git a/forgebot.sh b/forgebot.sh
index 98a246a..c0e3cac 100755
--- a/forgebot.sh
+++ b/forgebot.sh
@@ -7,9 +7,11 @@
# curl
# find
+rm -fr "${DATA_DIR:-.}/repo"
+git clone http://github.com/notenoughupdates/notenoughupdates-repo "${DATA_DIR:-.}/"repo --depth=1
function get_duration() {
- jq '.recipes[] | select(.type ="forge") | .duration * 1000' < repo/items/$1.json
+ jq '.recipes[] | select(.type ="forge") | .duration * 1000' < "${DATA_DIR:-.}"/repo/items/$1.json
}
diff --git a/forgebot_proper.sh b/forgebot_proper.sh
index 947be04..834347a 100755
--- a/forgebot_proper.sh
+++ b/forgebot_proper.sh
@@ -12,7 +12,7 @@ require_program() {
fi
done
}
-require_program curl jq websocat printf grep find sed mkdir touch rm mv mkfifo basename tty
+require_program curl jq websocat printf grep find sed mkdir touch rm mv mkfifo basename tty git
if ! [[ "$(grep --version)" = *GNU* ]]; then
echo Using non-GNU grep. This can cause issues since we use some non standard grep options.
exit 1
@@ -28,6 +28,7 @@ if [[ x"$HYPIXEL_KEY" == x ]]; then
echo "Please set HYPIXEL_KEY to your hypixel api key"
exit 1
fi
+echo Data dir: "${DATA_DIR:-.}"
source "$(dirname -- "$0")"/atrocity/load.sh
source "$(dirname -- "$0")"/hypixel_api.sh
source "$(dirname -- "$0")"/data.sh
diff --git a/repo b/repo
deleted file mode 160000
-Subproject 52f3f65469b9b5fcd976b4573a7927aba5371cb