Giter Site home page Giter Site logo

beebot's Introduction

Beebot

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

Table of Contents

  1. How to use it?
    1. Prerequesites
    2. Installation
      1. Discord bot
      2. SigFox API
      3. Install server
  2. References

How to use it?

Prerequisites

On your server, make sure that npm and nodejs are installed:

sudo apt install nodejs npm

Installation

Copy the config_sample.js file under the name config.js.

Creating the Discord bot

Login at the Discord developer portal and create a new app.

  1. In the "bot" section, choose a name and an avatar for your bot.
  2. Copy the bot token in the config.js file.
  3. In the "OAuth2" section, go to URL generator, check bot and the permissions you want for your bot.
  4. Copy the generated URL and paste it in your browser, you will be able to choose in which server you want to add it.

Create the SigFox API access

Login at the SigFox backend.

  1. Under the "Device type" section, select the group to which your SigFox module is linked.
  2. In the left bar menu, choose "API access".
  3. Create a new one, and choose the DEVICE_MANAGER [R] option.
  4. Copy login and password in the config.js file.

Install the server

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:

  1. Install PM2 (process manager for npm)
sudo npm install pm2@latest -g
  1. Start using PM2 for your service
pm2 start beebot/beebot.js
  1. Type the following line to create startup script
pm2 startup systemd
  1. Copy-paste the suggested command line to enable PM2 on boot
  2. Save the PM2 process list with pm2 save
  3. 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]...

References

This bot was inspired by the Insanotedur project, a bot that alerts students of new grades on their digital portal.

beebot's People

Contributors

tprigent avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.