Bot that sends SigFox messages to a Discord server.
In particular, it allows beehive owner to be alerted if suspicious activity is detected.
On your server, make sure that npm and nodejs are installed:
sudo apt install nodejs npmCopy 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.jsfile. - In the "OAuth2" section, go to URL generator, check
botand 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.jsfile.
Clone the project in an adequate folder, then cd in it and run:
npm installThis 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
usrby your username
sudo systemctl start pm2-usrNB: 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.