Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivstiv/lan-monitor-bot
A lightweight discord bot to monitor your network and notify you of events through Discord.
https://github.com/ivstiv/lan-monitor-bot
Last synced: 1 day ago
JSON representation
A lightweight discord bot to monitor your network and notify you of events through Discord.
- Host: GitHub
- URL: https://github.com/ivstiv/lan-monitor-bot
- Owner: ivstiv
- Created: 2020-01-12T00:10:24.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-07T15:39:54.000Z (over 2 years ago)
- Last Synced: 2023-03-03T09:40:37.909Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lan-monitor-bot
This a lightweight discord bot that can be, for example ran on a RaspberryPI to monitor your network and notify you of events through Discord. The bot uses the Address Resolution Protocol (ARP) to discover local devices. Of course you can run it on your computer if you wish to. I am planning to create triggers so that the bot can be linked with other IoT devices to easily automate stuff around the house such as triggering cameras, sensors etc. If you have any issues or need help setting it up try finding me in this discord server: https://discord.gg/jEghKHq
## Features
* Monitors devices on your network from discord.
* Shows last time a device has been online.
* Label the devices for easier recognition.
* Delete old devices from the list.
* (In development) Notify when a device goes offline/online with a message.
* (In development) Custom HTTP request calls to endpoints when a device goes online/offline. (Could be used to automate IoT devices)## Pictures
![Picture](https://github.com/Ivstiv/lan-monitor-bot/blob/master/pic.png)## Commands
The commands use the default prefix "+".* `+help | Shows all commands with descriptions.`
* `+label add | Adds a label to a device.`
* `+label remove | Removes a label from a device.`
* `+device remove | Removes a device from the list.`In development:
* `+notify online | Sends a message every time the device comes online.`
* `+notify offline | Sends a message every time the device goes offline.`## Setup a bot
1. [Here](https://www.digitaltrends.com/gaming/how-to-make-a-discord-bot/) is a tutorial on how to do that.Invitation link(populate CLIENT_ID and PERMISSIONS_ID):
>https://discordapp.com/oauth2/authorize?&client_id=CLIENT_ID&scope=bot&permissions=PERMISSIONS_ID## Installation
1. Make sure you have Node JS installed!2. Clone the repository.
3. Install the bot
`npm install`
4. Create a config file.`cp example-config.json config.json`
5. Edit the config with your own bot token and channel id. You can find more info on how to find them [here](https://github.com/Chikachi/DiscordIntegration/wiki/How-to-get-a-token-and-channel-ID-for-Discord).6. Start the bot.
`node index`
7. You can use tmux, screen, systemd or npm's package "forever" to hold the bot working on the background.8. Deamonizing with Systemd: There is a template file of a systemd service that you can use in the repository under the name `lanbot-example.service`. Just substitue the information in <> with the corresponding directories and add the file in `/lib/systemd/system`. After that you can simply enable it and start it with `systemctl enable --now lanbot`.
## Tips
If you get "?" in the names column this is because you are either running the bot on Windows or the DNS server that you are using is an external one and not the default gateway so there is no way to resolve the names.
Works really well on a RaspberryPI without putting a lot of processing load on it.
Make sure that only you have access to the channel since the information obtained from it could be used for malicious purposes.
If you move the bot your can restore all device data from the file "devices.json". Just move it in the bot's directory to be loaded on startup.
## Config
token - Bot's token, can be found in the discord's developers portal.prefix - Bot's prefix before the commands.
channelID - The ID of the channel where you want the bot to operate in.
utcOffset - If for some reason the timing of the bot is different from your timezone you can edit this to create an offset.
updatePeriod - Update rate of the displayed table.
savePeriod - Save rate of the data to a file.
## Links
* Discord.js docuemntation* ARP wiki page for reference