diff --git a/README.md b/README.md index 264c940..9fc8566 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ # auto_village -Telegram 自動收穫工作 Script,請搭配 Telegram CLI 使用。 \ No newline at end of file +Telegram 自動收穫工作 Script,請搭配 Telegram CLI 使用。 + +## Install + +1. 建立一個資料夾 `auto_village`,把 [`tg`](https://github.com/vysheng/tg) 編譯好登入進去。 + +2. `auto.sh` 放進去。 + +3. 把 `rc.local` 的內容放進 `/etc/rc.local` 之後打: + ```sh + # 打開 + sudo systemctl restart rc-local.service + # 關掉好像要用 + sudo systemctl kill rc-local.service + ``` \ No newline at end of file diff --git a/auto.sh b/auto.sh new file mode 100644 index 0000000..5615078 --- /dev/null +++ b/auto.sh @@ -0,0 +1,9 @@ +#! /bin/bash +sleep 3s + +while true; do + echo "dialog_list" | nc localhost 58787 + echo "msg Village_Game /work" | nc localhost 58787 + echo "msg Village_Game /harvest" | nc localhost 58787 + sleep 720s +done \ No newline at end of file diff --git a/rc.local b/rc.local new file mode 100644 index 0000000..f712a28 --- /dev/null +++ b/rc.local @@ -0,0 +1,2 @@ +sudo -u pinlin /home/pinlin/auto_village/tg/bin/telegram-cli -W -P 58787 -d & +sudo -u pinlin /home/pinlin/auto_village/auto.sh & \ No newline at end of file