Home
This is the first post in a series I'l be doing on my experiences using Slack [1] at the office. My company recently decided to switc to it for inter-office communication. I found several things that I disliked about the interface to their official client so I went searching for a better way to use their service. After very little effort I found a few options that looked promising. Slack offers an IRC gateway. This looked promising but since Slack offers some different features than standard IRC, the special Slack features were not made available. This was going to be a problem fo me. A little more searching uncovered wee-slack [2], a python plugi for the popular weechat [3] command line IRC client. This happens be my IRC client of choice and looked very promising. Instead of interfacing with the IRC gateway provided by Slack, it uses the Sla API to provide a more feature rich experience while still providing the familiar, IRC client interface and commands. This first post will be about my experience configuring WeeChat to the wee-slack plugin. Since I use a Macbook Pro for work, this info will likely be interesting but only directly useful to users of Mac Some pieces may carry over if your environment under Linux/BSD is similar. The installation of wee-slack is fairly straight forward and quick; similar to all other WeeChat plugins. You download the python scrip from their git repository and place it in your ~/.weechat/python directory. You then load it with /python load wee-slack.py from t weechat prompt. Upon doing this I received a python stack trace informing me that it was unable to load the 'websockets' module. A quick look at their documentation and I see that I need the websocket-client python module installed. Running `pip install websocket-client` from the command line should have fi this. Unfortunately, the error persisted. I have WeeChat installed using Homebrew [4] (a package manager for Homebrew compiles and installs packages from source. You can run `brew edit $APPNAME` to modify the homebrew version of a Makefile. This is where you ena special options for build-time. In the case of WeeChat, this is use to enable language specific plugin support. Python support is one o these options. I had already enabled Python support, but it was sti not working. Enter my user environment. I have an exceedingly complicated user environment on my work laptop. This is out of necessity due to the variance in the type of work I do from day to day. One of the speci caveats about my work environment is the use of pyenv [5] to manage multiple versions of python on the same system in a sane(ish) manne After much searching and discussion on IRC with weechat developers found out that CMAKE does some magic to discover where you have pyt installed. If you're using pyenv, this can confound things a little making it nearly impossible to figure out which version of python i has chosen to use and subsequently difficult to find out which pyth I needed install websocket-client in. The workaround is to statical define the python binary that should be used by CMAKE. This is done with the -DPYTHON_EXECUTABLE flag. Setting this to the global pytho version, rebuilding weechat, and installing the websocket-client module to the system python fixed the issue with running wee-slack. in weechat. As mentioned earlier, wee-slack.py uses a Slack legacy API token to interface with Slack. This is then loaded in to weechat using the command and restarting your weechat client: /set plugins.var.python.slack.slack_api_token [YOUR_SLACK_TOKEN] Initial impressions were very positive. There are some great featur built in to the core plugin and the default behavior is configured well out of the box. Tomorrow, I will discuss the configuration in more detail and explo some additional plugins that I've found useful for providing additional functionality and extending the built-in capabilities of wee-slack.py. I hope you've enjoyed this post, see you tomorrow! HTML [1] Slack HTML [2] wee-slack.py HTML [3] WeeChat HTML [4] Homebrew HTML [5] Pyenv