Bot that sends SigFox messages to a Discord server.
In particular, it allows beehive owner to be alerted if suspicious activity is detected.
![Capture d’écran 2023-08-15 à 16 16 25](https://private-user-images.githubusercontent.com/14911193/260735448-ed82cd29-069e-4766-89cf-2833a03b701a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzNjY1NjIsIm5iZiI6MTcxOTM2NjI2MiwicGF0aCI6Ii8xNDkxMTE5My8yNjA3MzU0NDgtZWQ4MmNkMjktMDY5ZS00NzY2LTg5Y2YtMjgzM2EwM2I3MDFhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI2VDAxNDQyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYzMWNmYWRkY2ViZDI5Yjc4N2M0ZTBlYWE2NTVhMDVmZDVjYjI5MDNhM2UwM2IwYjUxZjQzNDY4NTFhMzUyZWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.jhmetDUn6YIBho4FOLz5fNAYx36_aUt33UW3-3VAw1U)
On your server, make sure that npm
and nodejs
are installed:
sudo apt install nodejs npm
Copy the config_sample.js
file under the name config.js
.
Login at the Discord developer portal and create a new app.
- In the "bot" section, choose a name and an avatar for your bot.
- Copy the bot token in the
config.js
file. - In the "OAuth2" section, go to URL generator, check
bot
and the permissions you want for your bot. - Copy the generated URL and paste it in your browser, you will be able to choose in which server you want to add it.
Login at the SigFox backend.
- Under the "Device type" section, select the group to which your SigFox module is linked.
- In the left bar menu, choose "API access".
- Create a new one, and choose the
DEVICE_MANAGER [R]
option. - Copy login and password in the
config.js
file.
Clone the project in an adequate folder, then cd
in it and run:
npm install
This will install the Node.js server.
To make it run continuously and at server startup, check the following steps:
- Install PM2 (process manager for npm)
sudo npm install pm2@latest -g
- Start using PM2 for your service
pm2 start beebot/beebot.js
- Type the following line to create startup script
pm2 startup systemd
- Copy-paste the suggested command line to enable PM2 on boot
- Save the PM2 process list with
pm2 save
- Start the PM2 service and replace
usr
by your username
sudo systemctl start pm2-usr
NB: You can manage PM2 with the commands pm2 list
, pm2 monit
, pm2 stop [service-id]
, pm2 restart [service-id]
...
This bot was inspired by the Insanotedur project, a bot that alerts students of new grades on their digital portal.