GithubHelp home page GithubHelp logo

giuseongit / tinabot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from develer-staff/tinabot

2.0 2.0 0.0 40 KB

TinaBot è un bot Hubot e integrato con Slack che gestisce gli ordini del pranzo

License: MIT License

Shell 0.91% Batchfile 0.43% JavaScript 54.27% CoffeeScript 44.39%

tinabot's Introduction

TinaBot

TinaBot è un bot Hipchat basato su Hubot.

Ci permette di gestire gli ordini del TuttoBene tenendo una lista giornaliera degli ordini di ognuno, stampandola quando richiesto.

I comandi che possono essere inviati (citandolo) al bot sono:

  • @tinabot per me <ordine> - aggiunge all'ordine dell'utente
  • @tinabot per me niente - cancella il proprio ordine
  • @tinabot ordine - pubblica i dishes ordinati

Inoltre, nelle stanze in cui è attivo, tinabot è in ascolto delle parole TB (case-sensitive) o TuttoBene (case-insensitive)

Sviluppo

Hubot richiede npm 0.10.x installato.

Per iniziare clonare il repository e installare i pacchetti NPM necessari con npm install.

Lo script che fa tutto il lavoro è scripts/listapranzo.js. Si può modificare quello script o aggiungerne di nuovi.

Se si aggiunge un comando nuovo, va anche inserita la relativa descrizione in Commands all'inizio del file, in modo da farlo comparire nell'help del bot.

Provarlo in locale

Per provare TinaBot è sufficiente lanciare:

export HUBOT_HIPCHAT_JID="<utente del bot>"
export HUBOT_HIPCHAT_PASSWORD="<password del bot>"

./bin/hubot --adapter hipchat

Verrà lanciata la shell interattiva di TinaBot. Si può iniziare a guardarsi intorno con tinabot help.

Anche senza le variabili d'ambiente è comunque possibile interagire col bot direttamente dalla console.

Deployment

TinaBot è hostato presso Heroku. Fate riferimento alle istruzioni standard di Hubot per Heroku. È richiesta l'installazione di RedisToGo (basta la versione free). Il processo principale viene avviato da Heroku leggendo il file Procfile.

Sono richieste alcune variabili d'ambiente su Heroku:

HEROKU_URL:                      http://tinabot.herokuapp.com
HUBOT_HEROKU_KEEPALIVE_URL:      https://tinabot.herokuapp.com/
HUBOT_HIPCHAT_JID:               <utente del bot>
HUBOT_HIPCHAT_JOIN_PUBLIC_ROOMS: false
HUBOT_HIPCHAT_PASSWORD:          <password del bot>
HUBOT_HIPCHAT_ROOMS:             <Lista delle stanze in cui stare in ascolto (comma-separated)>
REDISTOGO_URL:                   <impostato da heroku>

HUBOT_HIPCHAT_ROOMS richiede il valore XMPP JID delle stanze, si trova nel sito di Hipchat.

Il remote GIT di Heroku è:

[remote "heroku"]
  url = https://git.heroku.com/tinabot.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

Per vedere i log o riavviare il bot i comandi necessari sono heroku logs e heroku restart. È necessario aver installato la Heroku CLI.

Hubot Heroku Keepalive

Dato che su Heroku i processi free si fermano se non c'è attività per 30 minuti viene usato hubot-heroku-keepalive per tenere attivo TinaBot.

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.