= Using RaspberryPI's for Creating an Interesting Slackbot = [[PageOutline]] == Install Node.js and NPM == It is always a good idea to the upgrade and update before adding packages after the initial installation of the OS on the PI. {{{ sudo apt-get upgrade sudo apt-get update }}} You might need to removed the old nodered, which might not be the package we want {{{ sudo apt-get remove nodered sudo apt-get remove nodejs nodejs-legacy sudo apt-get remove npm }}} And then get the latest node source and install {{{ curl -sL https://deb.nodesource.com/setup_6.x | sudo bash - sudo apt-get install -y build-essential python-dev nodejs }}} npm seems to come with nodejs. When trying to do an apt-get install npm, I get an error. Running with {{{ node --version v6.4.10 npm --version 3.10.3 }}} Here is an alternate way to install, but the above method seemed to work. {{{ wget http://node-arm.herokuapp.com/node_latest_armhf.deb sudo dpkg -i node_latest_armhf.deb }}} == Useful Pages to Read == === Node.js === https://nodejs.org/api [[BR]] http://nodeschool.io/#workshopper-list [[BR]] === NPM === https://www.sitepoint.com/beginners-guide-node-package-manager/ [[BR]] === Coffee - the little language that compiles into Javascript === http://coffeescript.org/ [[BR]] === Slack Pages === https://get.slack.help/hc/en-us/categories/202622877-Slack-Guides ==== BUA Diversity Slack Home Page ==== https://buadiversity.slack.com/messages/general/details/ == HUBOT Tutorial == Need to set up a bot in a slack page - So, you still need to set up a slack url and a new bot. Follow the instructions in https://scotch.io/tutorials/building-a-slack-bot-with-node-js-and-chuck-norris-super-powers and do the section on Create a new Bot in your slack organization. And then follow the tutorial in spice-up-your-slack-channel-with-hubot. https://www.sitepoint.com/spice-up-your-slack-channel-with-hubot/ [[BR]] It gives the most basic commands - none of the addons. The section after integrating with slack works except for the pug me section. I found that the [https://github.com/Emile-Filteau/hubot-catme/blob/master/src/catme.coffee hubot-catme] section does work. And I didn't bother to understand the Jarvis part of the tutorial that talked about checking when a user was active last. I went on with the example coffee script from the norrisbot git repository. This is the general hubot repository. It is worth looking at and following the scripting.md using the scripts/slackbot-examples.coffee file from [https://github.com/michikono/slackbot-tutorial Michikino Slackbot Tutorial] [[BR]] https://github.com/github/hubot.git [[BR]] https://github.com/github/hubot/blob/master/docs/scripting.md [[BR]] == !CatMe Pages == https://github.com/Emile-Filteau/hubot-catme/blob/master/src/catme.coffee [[BR] == Chuck Norris == Useful to do this tutorial also [https://scotch.io/tutorials/building-a-slack-bot-with-node-js-and-chuck-norris-super-powers Chuck Norris] - uses javascript instead of coffee. == Ship It Squirrels == http://theprogrammingbutler.com/blog/archives/2011/10/28/hubot-scripts-explained/ == Maybe Useful to Read == http://www.michikono.com/2015/07/10/in-depth-tutorial-on-writing-a-slackbot/ [[BR]] http://writing.kynan.net.au/2015/07/17/teach-your-raspberry-pi-to-talk-in-slack == Example Slackbots == I installed a couple on the Pi, parvifolius.bbn.com. To run the Chuck Norris bot and connect to https://buadiversity.slack.com {{{ cd /home/pi/norrisbot BOT_API_KEY=xoxb-48080620372-KHlo6i1AECTA0H7H1nZptr7r node bin/bot.js }}} On the #general slack channel at the URL above, any mention of Chuck Norris generated a random Chuck Norris joke. Look at lib/norrisbot.js to see how this works. To run the rabbithain bot: {{{ cd /home/pi/test-bot/ HUBOT_SLACK_TOKEN=xoxb-48595095201-QyWScPVPnV94pQaW7zneF5oJ ./bin/hubot -a slack }}} On the #general slack channel at the URL above, it can do a bunch of random things. Check the scripts/example.coffee and attached images for what it can do. It is a good example script to see what can be done with slackbots. == For Administration Purposes == Look into [http://pinet.org.uk/ PiNet] to help with classroom administration. I tried it and it seemed to work. It uses NFS to keep all files from the PI's onto the file server.