Skip to content

Commit

Permalink
docs: introduce project and how to use
Browse files Browse the repository at this point in the history
  • Loading branch information
hms5232 committed Feb 12, 2024
1 parent 3b0dbe3 commit a973357
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.example
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
53 changes: 52 additions & 1 deletion README.md
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)

0 comments on commit a973357

Please sign in to comment.