forked from iterativv/NostalgiaForInfinity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_nfx.sh
More file actions
executable file
·30 lines (26 loc) · 1.36 KB
/
update_nfx.sh
File metadata and controls
executable file
·30 lines (26 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Settings
url_nfi=https://api.github.com/repos/iterativv/NostalgiaForInfinity/releases/latest
bot_strategy_path=/bot/user_data/strategies # <- Replace this with your own path (e.g. /home/user/bot/user_data/strategies)
telegram_token=123123:123123 # <- Replace with your telegram bot token (e.g. 123123:123123)
telegram_chat_id=123123 # <- Replace with your telegram chat id (e.g. 123123)
##########
# Get latest release and copy it to bot_strategy_path
random_hash=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
version=$(curl -s ${url_nfi} | grep -o '"tag_name": ".*"' | sed 's/"tag_name": "//' | sed 's/"//')
url=$(curl -s ${url_nfi} | grep -o '"tarball_url": ".*"' | sed 's/"tarball_url": "//' | sed 's/"//')
folder_name=/tmp/nfx_${version}_${random_hash}
mkdir -p ${folder_name}
curl -s -L $url | tar xz -C ${folder_name} --strip-components 1
cp ${folder_name}/NostalgiaForInfinityX.py ${bot_strategy_path}/NostalgiaForInfinityX.py
rm -rf ${folder_name}
# Send message to telegram
curl -s -X "POST" "https://api.telegram.org/bot${telegram_token}/sendMessage" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"chat_id": "'$telegram_chat_id'",
"text": "<b>Update</b>\n<pre>Strategy <b>NostalgiaForInfinityX</b> has been updated to <b>'$version'</b>.</pre>",
"parse_mode": "HTML"
}'
# Restart bot
docker restart freqtrade