Coder Social home page Coder Social logo

housebot's Introduction

housebot

Housebot is a Twitch chat bot that lets your viewers control your Phillips Hue lights by voting in chat. It also has a couple of other bot basics.

Chat usage

Housebot chat commands all start with a bang (!). They are:

  • !housebot: Show commands.
  • !lights on|off|flicker: Vote for lights to turn on or off (by default 10 unique votes are required).
  • !quote: Display a random quote.
  • !addquote <quote>: Add a quote to be reviewed.
  • !todo <item>: Add an item to the todo list.
  • !todo: Display the todo list.
  • !mitosis: Make Housebot join your channel.
  • !seppuku: Make Housebot leave your channel.

Quotes added using !addquote need to be reviewed by the channel owner before they can be seen with !quote. To review quotes, channel owners have the following three extra commands:

  • !review: Show the oldest quote in the submission queue.
  • !approve: Move the oldest quote in the submission queue to the quotes list.
  • !reject: Destroy the oldest quote in the submission queue.

Lights

At the moment lighting support is rudimentary -- Housebot will scrape all lights from your bridge and chat commands will affect them all simultaneously. In the future, I think support for specifying Rooms and even Routines would be cool to add.

I hope this goes without saying, but please do not leave Housebot running when you don't want people on the internet controlling your lights.

Local devleopment

For Housebot's lighting commands to work, you'll need to run it locally. If you only care about the bot basics and not the lighting, you can !mitosis Housebot from an existing chat room.

The oddness of this command existing alongside the above recommendation to shut him down when not in use is because there's still plenty of work to do on Housebot, and ultimately I'd like to not require that people run him locally to get his full featureset safely.

Prerequisites

  • Node.js (brew install node)
  • CoffeeScript (npm install -g coffee-script)

Running

npm install
coffee housebot.coffee

A first-time run will interactively walk you through setting up a Twitch account for the bot to use and a Hue bridge to connect to for lighting control. You will need physical access to your Hue bridge so that you can press the big button on it.

For lighting commands in chat to work, open housebot.coffee and change the guard around line 29 to check for your channel, not mine. The intention of this guard is to prevent people from !mitosising Housebot into their own channel, then voting in a chat room invisible to you where you can't ban them from talking. This is a temporary band-aid.

housebot's People

Contributors

glacials avatar nicktimko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

knightrobby

housebot's Issues

Make a web interface

When housebot runs 24/7, it would be nice to be able to control him (read: my house) without using either IRC/Twitch chat or SSH. A web interface would be nice for a phone or computer or whatever. Nothing complicated, but it may deserve its own repository. Unless I want to add a web server component to housebot with Node.js. That may be interesting.

Ignore votes in channels which aren't live

If the channel a !vote came from isn't live, don't count the vote.

The Twitch API endpoint to use for this check is of the form https://api.twitch.tv/kraken/streams/glacials. If the returned object's stream is null, the channel is not live. Otherwise, it is. This call should probably be cached for a minute or so so that we don't have to make it every time a vote comes in.

Generalize device handling

Housebot currently expects a specific set of devices to appear in a specific order -- namely, the exact set of devices my house contains, appearing in the exact order my hub puts them in. This should be generalized to work with any potential set of devices.

The solution for this could range anywhere from reading devices in from a user-set devices file to showing a wizard-esque setup walkthrough on a first-time run.

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.