-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: introduce project and how to use
- Loading branch information
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TOKEN = '' # replace with bot token | ||
NOTIFY_USER_ID = '' # replace with user/group id which will receive message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,53 @@ | ||
# get-LAN-IP-telegram-bot-rs | ||
The Rust version of get-LAN-IP-telegram-bot | ||
The Rust version of [get-LAN-IP-telegram-bot](https://github.com/hms5232/get-LAN-IP-telegram-bot). | ||
|
||
## Background | ||
|
||
The original project is developed for Raspberry Pi. This saves me much time from IP checking. | ||
|
||
But, I'm not sure why the Python virtual environment can't get IP when RPi just booted. I resolved it with a stupid way: delay. | ||
|
||
This actually work. However, I need to keep waiting even device had booted until message delivered. | ||
|
||
Now, I migrate this project to Rust, and it seems more fast and reliable in my case. | ||
|
||
## Usage | ||
|
||
### Config | ||
|
||
You can use environment variables or dotenv. | ||
|
||
#### Environment | ||
|
||
```shell | ||
export TOKEN='bot token' | ||
export NOTIFY_USER_ID='chat id' | ||
``` | ||
|
||
#### dotenv | ||
|
||
```shell | ||
cp .env.example .env | ||
``` | ||
|
||
then replace value for your bot and chat/user id. | ||
|
||
※ The `.env` file should be placed same or parent dir with executable binary file. | ||
|
||
### Run on RPi | ||
|
||
Add the following line into `/etc/rc.local`: | ||
|
||
```shell | ||
(cd /path/to/binary && ./get-LAN-IP-telegram-bot-rs; cd -)& | ||
``` | ||
|
||
for example: | ||
|
||
```shell | ||
(cd /home/pi/Documents/get-LAN-IP-telegram-bot-rs && ./target/release/get-LAN-IP-telegram-bot-rs; cd -)& | ||
``` | ||
|
||
## LICENSE | ||
|
||
[MPL 2.0](LICENSE) |