I use Jabber for chat at work. It is not as slick as some of the other options chat services available, but it has its advantages:
And (emphasis mine):
After installing Err, you must create a data directory somewhere on your system where config and data may be stored. Find the installation directory of Err, then copy the file config-template.py to your data directory as config.py.
For a beginner like me, "somewhere on your system" is too vague. At this point
I was not sure how
errbot was supposed to know where the configuration file
and the data directory were located if I just put them "somewhere".
errbotwith the path to the configuration file, as I found out much later.
Thus, this is my own guide to installing Errbot, along with the adventures I came across. If you find it useful, let me know.
First we need to install
sudo yum -y install python-pip
Now let’s install Errbot:
sudo pip install err
And, per recommendations, let’s install extra dependencies needed to talk to our Jabber server:
sudo pip install sleekxmpp pyasn1 pyasn1-modules
Even though the guide lists
dnspython3 as an extra dependency, I found that
it would cause the bot to stop working. Fortunately, I learned this because
I accidentally did not install it to begin with, and only added it at a point
when I had a working bot.
python -vto find out) don’t install
So where is Errbot installed exactly? We can use the
locate command, but
first let’s make sure that its database is up to date:
sudo updatedb locate errbot
locate errbot will return a long list of paths:
/usr/bin/errbot /usr/lib/python2.7/site-packages/errbot /usr/lib/python2.7/site-packages/errbot/__init__.py ...
/usr/lib/python2.7/site-packages/errbot is the one we are interested in,
because that’s where we can find the configuration file template
config-template.py. Copy the template to
cd /usr/lib/python2.7/site-packages/errbot cp config-template.py config.py
config.py in your favorite editor (I use
vim). Here are
the changes I made to the configuration file:
BACKEND variable, and set the logging level to DEBUG just in
case we run into any problems:
BACKEND = 'XMPP' BOT_LOG_LEVEL = logging.DEBUG
Enter the credentials for the Jabber ID in the
In the examples that follow, change
jabberserver.tld to the hostname of your
# XMPP (Jabber) mode 'username': 'firstname.lastname@example.org', # The JID of the user you have created for the bot 'password': 'Temp1234', # The corresponding password for this user
List the users who can configure the bot:
BOT_ADMINS = ('email@example.com',)
Join our group chat:
CHATROOM_PRESENCE = ('firstname.lastname@example.org',)
And finally, give the bot a name. I asked for advice, and named it Bender, in honor of Bender Bending Rodriguez from Futurama:
CHATROOM_FN = 'Bender'
Now that the configuration part is behind us, let’s run Errbot!
alimac@centos7> errbot Traceback (most recent call last): File "/bin/errbot", line 5, in <module> from pkg_resources import load_entry_point File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3011, in <module> parse_requirements(__requires__), Environment() File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 626, in resolve raise DistributionNotFound(req) pkg_resources.DistributionNotFound: six>=1.7
Uh oh, it looks like we have a dependency that needs to be updated. The very
last line mentions that
six must be at version 1.7 or above. To upgrade:
pip install --upgrade six
Let’s try again:
alimac@centos7> errbot 18:49:04 INFO errbot.err Config check passed... 18:49:04 INFO errbot.err Selected backend 'XMPP'. 18:49:04 INFO errbot.err Checking for '/var/lib/err'... Traceback (most recent call last): File "/bin/errbot", line 9, in <module> load_entry_point('err==3.1.2', 'console_scripts', 'errbot')() File "/usr/lib/python2.7/site-packages/errbot/err.py", line 227, in main raise Exception(u"The data directory '%s' for the bot does not exist" % config.BOT_DATA_DIR) Exception: The data directory '/var/lib/err' for the bot does not exist
Fair enough, let’s create it (and make sure that the user we are running
as can write to this directory):
IOError: [Errno 2] No such file or directory: '/var/log/err/err.log'
Let’s create the log directory and file, too:
mkdir /var/log/err/ touch /var/log/err/err.log
.. and try one more time!
It looked like things were going to work, but...
18:50:23 ERROR sleekxmpp.xmlstream.xmlst Socket Error #185090050: _ssl.c:340: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
Researching this error led to me to a post on GitHub
which suggested uncommenting
XMPP_CA_CERT_FILE and setting setting it to:
XMPP_CA_CERT_FILE = None
And then finally...
... 19:00:07 DEBUG errbot.plugins.ChatRoom Try to join room 'email@example.com' 19:00:07 INFO errbot.plugins.ChatRoom Joining room firstname.lastname@example.org with username Bender
... Bender joined the chat.
Yes. Now we can run commands like
!help Plugins to interact with
That’s it for now. In Part II, I will explore installing plugins, and later maybe write my own plugin.
Was this guide useful? Did you notice any mistakes? Tell me.