Git Product home page Git Product logo

errbotio / errbot Goto Github PK

View Code? Open in Web Editor NEW
3.1K 73.0 611.0 5.44 MB

Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.

Home Page: http://errbot.io

License: GNU General Public License v3.0

Python 98.78% CSS 1.12% Shell 0.01% Dockerfile 0.10%
python chatbot chatops chat chatbots devops python3 automation hacktoberfest hacktoberfest2020

errbot's Issues

How to use w/ Google App or GTalk?

Hi,

I am trying to get err working with custom domain (as in Google App) but I am unable to find some good place to start. Can you share minimally how to get started for using GTalk? An example config-template.py would be great if you can help.

Thanks!
LT

Unhandled Error on command receive using irc backend

typing !help in irc results in an unhandled error

Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/words/protocols/irc.py", line 2413, in dataReceived
basic.LineReceiver.dataReceived(self, data.replace('\r', ''))
File "/usr/lib/python2.7/dist-packages/twisted/protocols/basic.py", line 564, in dataReceived
why = self.lineReceived(line)
File "/home/nvdk/err/errbot/backends/irc.py", line 44, in lineReceived
super(IRCConnection, self).lineReceived(line)
File "/usr/lib/python2.7/dist-packages/twisted/words/protocols/irc.py", line 2421, in lineReceived
self.handleCommand(command, prefix, params)
--- ---
File "/usr/lib/python2.7/dist-packages/twisted/words/protocols/irc.py", line 2465, in handleCommand
method(prefix, params)
File "/home/nvdk/err/errbot/backends/irc.py", line 55, in irc_PRIVMSG
msg.setFrom(fr + '@' + prefix)
File "/home/nvdk/err/errbot/backends/base.py", line 83, in setFrom
self.fr = Identifier(fr)
File "/home/nvdk/err/errbot/backends/base.py", line 24, in init
self.node, self.domain = jid.split('@')
exceptions.ValueError: too many values to unpack

!status throws a traceback.

Not sure about this one.

"
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/errbot/backends/base.py", line 196, in execute_and_send
reply = self.commands[cmd](mess, args)
File "/usr/local/lib/python2.7/dist-packages/errbot/errBot.py", line 180, in status
elif get_plugin_obj_by_name(name) and get_plugin_obj_by_name(name).get_configuration_template() and not self.get_plugin_configuration(name):
File "/usr/lib/python2.7/UserDict.py", line 180, in len
return len(self.keys())
File "/usr/local/lib/python2.7/dist-packages/errbot/storage.py", line 35, in keys
for key in self.shelf.keys():
AttributeError: 'Webserver' object has no attribute 'shelf'

Errbot timeout - bot keeps dying

I'm running errbot on EC2 connecting to hipchat. The bot keeps dying multiple times a day. I see the following error message in the ERROR log. Is there a timeout option available in config.py?

I could get around this by using monit or some other process watcher, however the pid doesn't get killed, the bot just disconnects and the pid stays forever.

2012-08-16 22:13:20,709 ERROR Failed to daemonize the process
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/err-1.4.2-py2.7.egg/EGG-INFO/scripts/err.py", line 130, in
main()
File "/usr/local/lib/python2.7/dist-packages/err-1.4.2-py2.7.egg/EGG-INFO/scripts/err.py", line 88, in main
holder.bot.serve_forever()
File "/usr/local/lib/python2.7/dist-packages/err-1.4.2-py2.7.egg/errbot/jabberbot.py", line 801, in serve_forever
conn.Process(1)
File "/usr/local/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 303, in dispatch
handler'func'
File "/usr/local/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 215, in streamErrorHandler
raise exc((name,text))
StreamError: (u'service-unavailable', u'Timed out after 150s of inactivity')

ERR not Rejoining HIPCHAT Rooms

Occasionally my ERR bot drops out of our teams main HIPCHAT channel and doesn't return. I have to open a private message and restart him in order to get him to come back.

1.2.0 : chatroom plugin crashes at startup

ERROR:callback_connect failed for <ChatRoom object at 0x108b0d0>
Traceback (most recent call last):
File "/home/gbin/projects/err/errbot/errBot.py", line 91, in signal_connect_to_all_plugins
bot.callback_connect()
File "/home/gbin/projects/err/errbot/builtins/chatRoom.py", line 32, in callback_connect
self.keep_alive()
File "/home/gbin/projects/err/errbot/builtins/chatRoom.py", line 17, in keep_alive
self.bare_send(pres)
File "/home/gbin/projects/err/errbot/botplugin.py", line 77, in bare_send
return holder.bot.connect().send(xmppy_msg)
AttributeError: 'NoneType' object has no attribute 'send'

Abstract the connectors backend

Right now the way we for example switch to test or graphical mode is plain hideous.

We should make a clear backend API so we can also implement bridges to other services like Campfire, IRC etc...

Error while installing err-gitbot plugin

Hello, I've been experimenting with err bot a little and found this odd error.

After "correct installation" of this plugin:

[00:11:38] <me> !install err-gitbot
[00:11:38] <bot JID> A new plugin repository named err-gitbot has been installed correctly from git://github.com/gbin/err-gitbot.git. Refreshing the plugins commands...
[00:11:38] <bot JID> Plugin reload done.

This is what has been logged. Apparently, plugin does not work.

2012-06-29 00:11:38,039 INFO received command = install matching [install] with parameters [err-gitbot]
2012-06-29 00:11:38,961 WARNING Unable to execute the code in plugin: /tmp/err/plugins/err-gitbot/gitBot
2012-06-29 00:11:38,961 INFO Activating all the plugins...

However, err-gitbot repository has been cloned correctly. Also, with err-gitbot in plugins folder, this is what happened after restarting the bot (first two lines of the log):

2012-06-29 00:02:35,068 WARNING Unable to execute the code in plugin: /tmp/err/plugins/err-gitbot/gitBot
2012-06-29 00:02:35,069 INFO Start Connection ...........

I tried to trace this warning. However, I wasn't able to find where is this warning logged and what caused this error.
I tried to install err-stalkerbot and err-calcbot and no such errors occured in those cases.

Env:
Python 2.7.3, dependencies installed by pip into separated virtualenv, OS X 10.6.8

The same error is occuring on up-to-date (28. 6. 2012) Arch Linux, python 2.7.3

Double Post Response

Connected to Hipchat ( -d -H) with and w/out Async enabled. All command responses are doubled. For example, if I !help, I get two separate and complete help responses back. Cranking the log files down to DEBUG do not seem to provide any clues for why that is.

Plugins directory permissions are unsafe

On first start err creates "plugins" directory in /var/lib with 0777 rights. I think this is unsafe and should be changed at least to 0755.

Checked in Gentoo, err-1.2.1. Ebuild in my overlay(branch err) fix(actually, just workaround) this issue by creating directory itself before err's first run. But i think that it should be fixed in upstream by setting proper umask in err itself.

Timeout after 150s on Hipchat

I get time outs when running the bot on HipChat:

ERROR:conn.Process exception
Traceback (most recent call last):
  File "/Users/luis/err.git/errbot/backends/jabber.py", line 536, in serve_forever
    conn.Process(1)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xmpp/dispatcher.py", line 303,
 in dispatch
    handler['func'](session,stanza)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xmpp/dispatcher.py", line 215,
 in streamErrorHandler
    raise exc((name,text))
StreamError: (u'service-unavailable', u'Timed out after 150s of inactivity')

I am running 1.6.0 (and now aaea558)

!install should check for git

I think that !install should checks for existance of git binary in case of installing plugins from git repos. Now if git does not installed installing plugin from git repo triggers only "No such file or directory" message. It can be hard for user to understand which file he does not have :-)

!webstatus problem

me
!webstatus
err
Computer says nooo. See logs for details.:
'SharedDataMiddleware' object has no attribute 'url_map'

xmpp.protocol.SeeOtherHost: (u'see-other-host', u'talk.google.com') Exception

Got following exception:

holder.bot.serve_forever()
File "/opt/dockstarmailer/dockstar-gtalk/err/errbot/jabberbot.py", line 823, in serve_forever
conn.Process(1)
File "/opt/dockstarmailer/dockstar-gtalk/xmpp/dispatcher.py", line 303, in dispatch
handler'func'
File "/opt/dockstarmailer/dockstar-gtalk/xmpp/dispatcher.py", line 215, in streamErrorHandler
raise exc((name,text))
xmpp.protocol.SeeOtherHost: (u'see-other-host', u'talk.google.com')

Proposal : Implement history

UP in test mode

!! -> would recall the last command
!history -> display the history
!2 -> would recall the second command from the history

Install guide for ubuntu 12.04?

Has anyone gotten 1.6 installed on ubuntu 12.04? A bunch of the dependencies are busted (twisted, pyside, etc). I need to update to 1.6 to bypass a timeout issue, but still not having much luck.

thanks

Failure to reconnect after long network outage

After a long (estimate a few hours) network outage, my errbot instance failed to reconnect. Looking at the output, it had been attempting to reconnect every 10 minutes for a long time. However, at some point, one of these reconnection attempts began and nothing happened from that point on - possibly it had hung.

I have no further debug info available on this occasion. Wondering if perhaps there's some kind of resource leak in that reconnect/didn't work/wait 10 minutes/try again cycle that caused it to eventually fail.

config.py timeout

Is there a timeout option for err? I'm running err on ec2 and it keeps dying. I see this when I turn the ERROR logging on.

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/err-1.4.2-py2.7.egg/EGG-INFO/scripts/err.py", line 130, in
main()
File "/usr/local/lib/python2.7/dist-packages/err-1.4.2-py2.7.egg/EGG-INFO/scripts/err.py", line 88, in main
holder.bot.serve_forever()
File "/usr/local/lib/python2.7/dist-packages/err-1.4.2-py2.7.egg/errbot/jabberbot.py", line 801, in serve_forever
conn.Process(1)
File "/usr/local/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 303, in dispatch
handler'func'
File "/usr/local/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 215, in streamErrorHandler
raise exc((name,text))
StreamError: (u'service-unavailable', u'Timed out after 150s of inactivity')

Possible corruption on hipchat reconnect

File "/home/gzangirolami/.pythonbrew/venvs/Python-2.7.2/hipbot/lib/python2.7/site-packages/err-1.4.1-py2.7.egg/EGG-INFO/scripts/err.py", line 149, in
main()
File "/home/gzangirolami/.pythonbrew/venvs/Python-2.7.2/hipbot/lib/python2.7/site-packages/err-1.4.1-py2.7.egg/EGG-INFO/scripts/err.py", line 88, in main
holder.bot.serve_forever()
File "/home/gzangirolami/.pythonbrew/venvs/Python-2.7.2/hipbot/lib/python2.7/site-packages/err-1.4.1-py2.7.egg/errbot/jabberbot.py", line 783, in serve_forever
conn = self.connect()
File "/home/gzangirolami/.pythonbrew/venvs/Python-2.7.2/hipbot/lib/python2.7/site-packages/err-1.4.1-py2.7.egg/errbot/errBot.py", line 122, in connect
self.activate_non_started_plugins()
File "/home/gzangirolami/.pythonbrew/venvs/Python-2.7.2/hipbot/lib/python2.7/site-packages/err-1.4.1-py2.7.egg/errbot/errBot.py", line 108, in activate_non_started_plugins
errors = activate_all_plugins(self.internal_shelf['configs'])
File "/home/gzangirolami/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/shelve.py", line 122, in getitem
value = Unpickler(f).load()
cPickle.UnpicklingError: pickle data was truncated

Admin-only command called from MUC

When admin-only command is called from MUC (group message or chat (PM)) bot crashes with unhandled exception from within jabberbot class (master branch):

Traceback (most recent call last):
File "scripts/err.py", line 135, in
main()
File "scripts/err.py", line 86, in main
holder.bot.serve_forever()
File "/home/pkcs/temp/err/errbot/jabberbot.py", line 786, in serve_forever
conn.Process(1)
File "/home/pkcs/.virtualenvs/errbot/lib/python2.7/site-packages/xmpp/dispatcher.py", line 303, in dispatch
handler'func'
File "/home/pkcs/temp/err/errbot/errBot.py", line 82, in callback_message
super(ErrBot, self).callback_message(conn, mess)
File "/home/pkcs/temp/err/errbot/jabberbot.py", line 644, in callback_message
raise Exception('You cannot administer the bot from a chatroom, message the bot directly')
Exception: You cannot administer the bot from a chatroom, message the bot directly

jabberbot.py, lines 642 to 648, both exceptions are unhandled.

I suppose ignoring this call or return warning would be more appropriate. :)

Apophys

Configurable command prefix

I really need to be able to configure the command prefix (currently '!') to something else, as is common with most bots. The most common use case of this is to allow it to coexist with other bots in the same room, by all of them using a different prefix. Another use case, which is driving me, is that I'm talking privately to an instance of err via a touchscreen smartphone, where accessing '!' for every command is slightly painful, but '.' would be much nicer.

Happy to do the work for this and submit a pull request, but to do it right involves trivial but numerous changes, because currently the '!' is hard-coded into every help string, etc. I though I'd see what you think about making that change first, rather than just submitting a "changes every file" request.

High CPU Usage by err (python) past reconnection

I have no clue as where the could be happening :(

Tasks: 65 total, 2 running, 63 sleeping, 0 stopped, 0 zombie
%Cpu(s): 91.5 us, 3.6 sy, 3.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 2.0 si, 0.0 st
KiB Mem: 125036 total, 122876 used, 2160 free, 1692 buffers
KiB Swap: 525308 total, 17760 used, 507548 free, 71708 cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21276 root 20 0 64632 15m 4320 R 91.5 12.5 60:21.01 python
18397 debian-t 30 10 53612 17m 3392 S 5.6 14.4 21:44.56 transmission-da
20596 root 20 0 0 0 0 S 1.0 0.0 0:29.70 kworker/u:0
5651 root 20 0 5712 1452 592 S 0.7 1.2 0:37.79 screen

Disconnection breaks the web chatroom

Start the bot,
ifconfig eth1 down
Wait for the bot to realize something went wrong and try to reconnect

ifconfig eth1 up
It reconnects then at every message.
Boom.
Traceback (most recent call last):
File "/home/gbin/projects/err/errbot/errBot.py", line 115, in send_message
bot.callback_botmessage(mess)
File "/home/gbin/projects/err/errbot/builtins/webserver.py", line 254, in callback_botmessage
self.emit_mess_to_webroom(mess)
File "/home/gbin/projects/err/errbot/builtins/webserver.py", line 242, in emit_mess_to_webroom
for sessid, socket in self.server.sockets.iteritems():
AttributeError: 'NoneType' object has no attribute 'sockets'

Traceback in build_message

I'm continually receiving the following traceback installing the latest version of err from source. I'm able to install err-weatherbot, but the logs keep spewing the following. Any help would be appreciated.

I'm installing on ec2 using ubuntu precise:

  • Python 2.7.3-0ubuntu2

-- Install steps

  • git clone git://github.com/gbin/err.git
  • apt-get install python-pip
  • pip install -r requirements.txt
  • mkdir /etc/err && cp errbot/config-template.py /etc/err/config.py
  • mkdir /var/lib/err
  • mkdir /var/lib/err/err.log
  • touch /var/log/err/err.log
  • err.py -c /etc/err

ERROR:crashed in callback_message expected string or buffer
Traceback (most recent call last):
File "", line 51, in callback_message
File "/usr/local/lib/python2.7/dist-packages/err-1.4.2-py2.7.egg/errbot/botplugin.py", line 209, in send
return holder.bot.send(user, text, in_reply_to, message_type)
File "/usr/local/lib/python2.7/dist-packages/err-1.4.2-py2.7.egg/errbot/jabberbot.py", line 381, in send
mess = self.build_message(text)
File "/usr/local/lib/python2.7/dist-packages/err-1.4.2-py2.7.egg/errbot/jabberbot.py", line 415, in build_message
text_plain = re.sub(r'<[^>]+>', '', text)
File "/usr/lib/python2.7/re.py", line 151, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or buffer

UnicodeDecodeError on !apropos

Some plugins (I didn't track down which one(s) specifically) from the repos break the !apropos command because they have non-ascii characters within their docstrings:

Nick Groenen: !apropos foo
Err Bot: Computer says nooo. See logs for details.:
'ascii' codec can't decode byte 0xc2 in position 94: ordinal not in range(128)

012-09-26 22:25:12,327 INFO received command = apropos matching [apropos] with parameters [foo]
2012-09-26 22:25:12,328 ERROR An error happened while processing a message ("apropos foo") from [email protected]/8e241d59: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/errbot/backends/base.py", line 237, in execute_and_send
    reply = self.commands[cmd](mess, args)
  File "/usr/local/lib/python2.7/dist-packages/errbot/errBot.py", line 428, in apropos
    for (name, command) in clazz_commands[clazz] if args is not None and command.__doc__ is not None and args.lower() in command.__doc__.lower() and name != 'help' and not command._err_command_hidden
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 94: ordinal not in range(128)
"
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/errbot/backends/base.py", line 237, in execute_and_send
    reply = self.commands[cmd](mess, args)
  File "/usr/local/lib/python2.7/dist-packages/errbot/errBot.py", line 428, in apropos
    for (name, command) in clazz_commands[clazz] if args is not None and command.__doc__ is not None and args.lower() in command.__doc__.lower() and name != 'help' and not command._err_command_hidden
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 94: ordinal not in range(128)

Unable to join hipchat room

My bot connects, but doesn't seem to join the chatrooms. If you could point out what I'm doing incorrectly...

My config file:

import logging
import os.path

THIS_LOCATION = os.path.dirname(os.path.abspath(__file__))
BOT_LOG_LEVEL = logging.DEBUG
BOT_LOG_FILE = os.path.join(THIS_LOCATION, 'err.log')

BOT_IDENTITY = {
    'username' : '[email protected]',
    'password' : 'xxxxxx'
}

BOT_ADMINS = ('[email protected]',) 
BOT_DATA_DIR = os.path.join(THIS_LOCATION, 'data')
BOT_EXTRA_PLUGIN_DIR = os.path.join(THIS_LOCATION, 'plugins')

_TEST_ROOM = '12345_test'
CHATROOM_PRESENCE = ('12345_nse', _TEST_ROOM,)
CHATROOM_RELAY = {'[email protected]' : (_TEST_ROOM,)}
CHATROOM_FN = 'ID Bot'
HIPCHAT_MODE = True

Here is the debug log https://gist.github.com/3072438

err can't communicated with me :(

unhandled message type <message xmlns="jabber:client"
...
...
...

If set, the 'from' attribute must be set to the user's full JID.

Identify as bot in initial presence (HipChat)

When connecting to HipChat, you can have the bot identify itself as such by sending a special caps node (XEP-0015). See the wobot implementation here: cjoudrey/wobot#16

Right now the main benefit of this is that the session will display as a bot on hipchat.com/account/sessions, but in the future we may begin allowing special behavior for bots. :)

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.