1stvamp / hippybot Goto Github PK
View Code? Open in Web Editor NEWHipchat.com bot written in Python with a simple plugin API
License: Other
Hipchat.com bot written in Python with a simple plugin API
License: Other
I see several references to HipChat's v1 API, does hippybot support v2 as well? if not, are there plans on supporting it?
User has a unicode character in his username. This results, and hippybot crashes:
ERROR: 'ascii' codec can't encode character u'\xae' in position 34: ordinal not in range(128)
Traceback (most recent call last):
File "/home/michael/work/hippybot/python/lib/python2.7/site-packages/hippybot-1.2.4-py2.7.egg/hippybot/bot.py", line 291, in run
bot.serve_forever()
File "/home/michael/work/hippybot/python/src/jabberbot/jabberbot.py", line 823, in serve_forever
conn.Process(1)
File "build/bdist.linux-x86_64/egg/xmpp/dispatcher.py", line 303, in dispatch
handler['func'](session,stanza)
File "/home/michael/work/hippybot/python/lib/python2.7/site-packages/hippybot-1.2.4-py2.7.egg/hippybot/bot.py", line 156, in callback_message
ret = cmd(mess)
File "/home/michael/work/hippybot/python/lib/python2.7/site-packages/hippybot-1.2.4-py2.7.egg/hippybot/plugins/plusplusbot.py", line 32, in change_score
room = str(mess.getFrom()).split("/")[0]
UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 34: ordinal not in range(128)
I am unable to run Hippybot. I get an import error stating no module named wave.
I am using Python 2.7 on Windows 7 64-bit.
> hippybot.exe -c hippybot.conf
ERROR: No module named wave
Traceback (most recent call last):
File "C:\Python27\venv\py27-hippybot\lib\site-packages\hippybot\bot.py", line
256, in run
bot = HippyBot(self.config._sections)
File "C:\Python27\venv\py27-hippybot\lib\site-packages\hippybot\bot.py", line
69, in __init__
self.load_plugins()
File "C:\Python27\venv\py27-hippybot\lib\site-packages\hippybot\bot.py", line
190, in load_plugins
module = do_import(path)
File "C:\Python27\venv\py27-hippybot\lib\site-packages\hippybot\bot.py", line
26, in do_import
mod = __import__(name)
File "C:\Python27\venv\py27-hippybot\lib\site-packages\lazy_reload.py", line 8
3, in _lazy_reload_import
m = _real_import(name, globals, locals, fromlist, level)
ImportError: No module named wave
Currently describes mapping aliases to methods, but the actual functionality is mapping to commands.
I am trying to write a plugin for hippybot but i cannot seem to even get the basic hello_world sample plugin loaded.
I created a file hippybot/plugins/hello_world.py and added the content in the README, i then added the line hippybot.plugins.hello_world to the config (corectly indented) and then went to start the bot and it spits out an error from bot.py and lazy_reload.py saying "ImportError: No module named hello_world" i tried writing my own also and i get the same issue, as soon as i remove this plugin from the config and just leave the defaults it works great.
Any ideas?
The code is hard-wired to use the Atlassian HipChat server. There needs to be a config option (not compulsory to make it easy for people already using hippybot) to allow for an in-house HipChat server to be used.
These were added in 1.1.0 but the readme wasn't updated.
Unsure if this is related, but it's throwing an
"ERROR:jabberbot:item-not-found"
upon start.
I installed via pip install hippybot, but I had to manually install beautifulsoup via pip as well.
I've verified from the XMPP (hipchat.com/account/xmpp) page that the room names are correct. I'm using the XMPP names, but I've also tried the HipChat room names.
What am I doing wrong?
Currently you can cheat in doing multiple directed replies by just returning a big string with replies on each line, but this is hacky and we can do better.
The better solution would be to allow returning an iterable (tuple, list, generator etc.) from a command, and each is replied in turn.
For @directmd
these would all respond to the original user, and just straight posts for @botcmd
and @contentcmd
.
There should be a user guide, preferably avail on RTD.
using the example plugin as follows:
from hippybot.decorators import botcmd, directcmd
class Plugin(object):
global_commands = ['hello_world']
command_aliases = {'hi!' : 'hello'}
@botcmd
def hello_world(self, mess, args):
return u'Hello world!'
@directcmd
def hello(self, mess, args):
return u'Well hello there..'
I'm inclined to believe an update to jabber has recently broken this functionality, but I can't be sure.
Hi,
After the config, I ran the bot but got the following errors:
23:27 $ hippybot -c hippybot.conf
ERROR: <slot wrapper 'init' of 'object' objects> is not a Python function
Traceback (most recent call last):
File "/Users/kanwu/Documents/workspace/itsi_bot/lib/python2.7/site-packages/hippybot-1.2.7-py2.7.egg/hippybot/bot.py", line 325, in run
bot = HippyBot(self.config._sections)
File "/Users/kanwu/Documents/workspace/itsi_bot/lib/python2.7/site-packages/hippybot-1.2.7-py2.7.egg/hippybot/bot.py", line 89, in init
self.load_plugins()
File "/Users/kanwu/Documents/workspace/itsi_bot/lib/python2.7/site-packages/hippybot-1.2.7-py2.7.egg/hippybot/bot.py", line 235, in load_plugins
getattr(module, 'Plugin').init)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 816, in getargspec
raise TypeError('{!r} is not a Python function'.format(func))
TypeError: <slot wrapper 'init' of 'object' objects> is not a Python function
Here is what my conf file looks like:
[plugins]
load_path = /Users/kanwu/Documents/workspace/itsi_bot/hippybot-1.2.7/hippybot/plugins/
load = rot13
If I change my config file to the following:
[plugins]
load_path = /Users/kanwu/Documents/workspace/itsi_bot/hippybot-1.2.7
load = hippybot.plugins.rot13
I got the following errors
_3:29 $ hippybot -c hippybot.conf
ERROR: No module named rot13
Traceback (most recent call last):
File "/Users/kanwu/Documents/workspace/itsi_bot/lib/python2.7/site-packages/hippybot-1.2.7-py2.7.egg/hippybot/bot.py", line 325, in run
bot = HippyBot(self.config._sections)
File "/Users/kanwu/Documents/workspace/itsi_bot/lib/python2.7/site-packages/hippybot-1.2.7-py2.7.egg/hippybot/bot.py", line 89, in init
self.load_plugins()
File "/Users/kanwu/Documents/workspace/itsi_bot/lib/python2.7/site-packages/hippybot-1.2.7-py2.7.egg/hippybot/bot.py", line 222, in load_plugins
(file, filename, data) = imp.find_module(name, self._load_path)
ImportError: No module named rot13
Is it because my python path was not set properly?
When attempting to run I get:
Traceback (most recent call last):
File ".../src/work/infrabot/.env/lib/python2.7/site-packages/hippybot/bot.py", line 256, in run
bot = HippyBot(self.config._sections)
File ".../src/work/infrabot/.env/lib/python2.7/site-packages/hippybot/bot.py", line 61, in __init__
self.join_room(channel, config['connection']['nickname'])
File ".../src/work/infrabot/.env/lib/python2.7/site-packages/hippybot/bot.py", line 166, in join_room
self.connect().send(pres)
File ".../src/work/infrabot/.env/lib/python2.7/site-packages/jabberbot.py", line 208, in connect
conres = conn.connect()
File ".../src/work/infrabot/.env/lib/python2.7/site-packages/xmpp/client.py", line 205, in connect
while not self.TLS.starttls and self.Process(1): pass
File ".../src/work/infrabot/.env/lib/python2.7/site-packages/xmpp/dispatcher.py", line 303, in dispatch
handler['func'](session,stanza)
File ".../src/work/infrabot/.env/lib/python2.7/site-packages/xmpp/transports.py", line 337, in StartTLSHandler
self._startSSL()
File ".../src/work/infrabot/.env/lib/python2.7/site-packages/xmpp/transports.py", line 316, in _startSSL
tcpsock._sslIssuer = tcpsock._sslObj.issuer()
AttributeError: '_ssl._SSLSocket' object has no attribute 'issuer'
HipChat now requires the resource part of the JID to be, otherwise it errors.
A user can change their HipChat mention name by going into their web settings.
However, the current method of getting the name to send a direct message to is by manipulating the from field in the message:
In https://github.com/1stvamp/hippybot/blob/master/hippybot/decorators.py:
username = unicode(origin.getFrom()).split('/')[1].replace(" ","")
If the user has changed their mention name to something other than the concatenation of their first and last name, then hippybot direct messaging won't work as intended.
Via the HipChat API, it looks like you can pull the user's mention_name:
https://www.hipchat.com/docs/api/method/users/show
If the user has an API token configured, you could pull their mention_name via the HipChat API and then leverage it. Cache it, too, for bonus points!
it looks like you can pull all users at once via the HipChat API, so another way to solve would be to pull the list on bot startup and cache it. It misses some edge cases (new users or users that change their mention_name since the bot started up), but the list could be re-pulled on bot reload.
GET /v1/users/list?format=json&auth_token=token HTTP/1.1
Host: api.hipchat.com
Unfortunately, it looks like the HipChat API token has to be an admin token in order to pull the user list.
My company has a room named "Red October" in hipchat. In order to connect I had to change this in the config to "red_october" which works just fine.
To repro, simply run a bot connected to a room with only 1 human participant. Wait 150seconds.
Traceback (most recent call last):
File "bot.py", line 210, in <module>
sys.exit(main())
File "bot.py", line 200, in main
bot.serve_forever()
File "/usr/local/lib/python2.7/dist-packages/jabberbot.py", line 601, in serve_forever
conn.Process(1)
File "/usr/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 303, in dispatch
handler['func'](session,stanza)
File "/usr/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 215, in streamErrorHandler
raise exc((name,text))
xmpp.protocol.StreamError: (u'service-unavailable', u'Timed out after 150s of inactivity')```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.