So I was trying to set up a Slack audio bot at the office yesterday. Tried it out at home the night before and it went beautifully. 10 minute job 👌
Confident as hell I get into the office and set out to make it work. 2 hours later. Still no bot.
Here's how you do it in theory:
1. git clone slack-audiobot from here https://github.com/BrenMurrell/slack-audiobot
2. Create a new Slack bot on Slack (only have to do it once)
3. Copypasta an access token
4. node audiobot.js
💥 Boom you can @bot play bell 🔊
Had the bot, all I need at the office is a computer, node audiobot.js, connect to Sonos and voila.
We had a spare Chromebook. Ok it worked on a Mac, how hard can it be?
Oh you need to install node. No biggy, need to install on Mac too.
Oh you need a terminal first.
What, no terminal?
Nah. Switch to developer channel. WARNING THERE ARE BUGS
Okay but I ened terminal
Wait to download and reinstall machine. Cool.
Oh you want to install stuff? Switch to linux mode.
Another big download and install.
Great I'm in Linux. apt-get isntall node right?
Nope. That's node v4.
Okay do some weird shenanigans, run cryptic commands from random blogs, get apt sources updated.
Now you have the latest node.
Oh but you don't have git.
2 hours of shaving all the yaks later and I have a running node audiobot.js
@bot play bell
What's this thing trying to run anyway?
Tweak some code. Add some logs. See what it's doing.
afplay does not exist
Wtf is afplay?
Audio File Play is a cli mp3 player for macOS
Ah! But it's using mplayer on windows. Mplayer exists for Linux too!!
apt-get install mplayer
Audio device hanged.
We had a spare Mac too. Setup took 10 minutes including a fresh node install and telling AirPlay to connect to Sonos.