Giter Club home page Giter Club logo

attendancebot's Introduction

Attendance Bot

πŸŽ‰πŸŽˆπŸŽ‚πŸΎπŸŽŠπŸ»πŸ’ƒ

Automated attendance checker via slack.

Simple serverless script that will query for user presence as a means of determining attendance.

The daily portion is achieved with a configured CRON job on Webtask. This job will invoke a function that POSTs to a Slack Incoming Webhook. We query slack for channels created on the day of execution (assuming a fresh channel has been started pertaining to contents of current lecture) and based on those channels we further check for a keyword (defaults to lecture). Based on members in channels that match the above two criteria, we query for presence and push to another slack channel for measurement.

Self explanatory, chatroom tool in use like...a lot. They've great API support! Super developer friendly! Great vehicle for practice content delivery.

Javascript focused serverless tool, very easy to configure and deploy. However, it is not meant to be used for more involved applications. Future iterations of this bot may have to migrate over to AWS Lambda for this reason.

BUILDING AND DEPLOYING

There's a few steps required to deploy this script. Ideally, these steps could be made simpler - please submit PRs and ideas/issues around this!

INSTALLATION

$ <git clone repo, cd into it>
$ cd app/
$ npm install

Everything is installed locally, so you will have to use ./node_modules/.bin/<script> to run scripts. Yes, this is annoying. Yes, it is worth the pain.

INIT WEBTASK

If you don't have webtask CLI already set up, please do so now. Setting up Webtask CLI.

SECRETS

In order to properly use this script, you will have to supply some scripts. In the app/ directory you will see a .secrets.txt.sample.

First, let's copy it.

$ cd app/
$ cp .secrets.txt.sample .secrets.txt

Below, please find an explanation of what each key does. NOTE: Not all are "secrets" per-se but for now easier to keep all in one place.

SLACK

SLACK_USER_TOKEN=XXXXXXXXXXX
SLACK_WEBHOOK=https://hooks.slack.com/services/XXXXXXXXXXX/XXXXXXXXXXX/XXXXXXXXXXX
BOT_DAY=tuesday,thursday
SECRET NAME SECRET VALUE
SLACK_USER_TOKEN legacy user token)
SLACK_WEBHOOK refers to slack incoming webhooks. Set that up here
BOT_DAY days to execute bot, time is determined by CRON script

DEPLOY

$ cd app/
$ npm run deploy -- -t sample-task -c "50 20 * * *"

Where -c is defined CRON frequency, -t is the name of your task.

Donezo!

TODOS

  • Better test coverage
  • More meaningful tests
  • Convert more of the javascript codebase to use webpack generated 'bundle.js'
  • Dedicated AWS Lambda / DynamoDB store (ie: migrate off of MyJSON API)

PRs welcome! Please follow guidelines here.

This project is a remotecontrol service.

attendancebot's People

Contributors

mottaquikarim avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

celestelayne

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.