butterfield icon indicating copy to clipboard operation
butterfield copied to clipboard

Bot should recognise other bots

Open ingardm opened this issue 9 years ago • 0 comments

The example from the docs would print an error about 'text' not existing in a message from an incoming webhook.

import asyncio from butterfield import Bot

@asyncio.coroutine def echo(bot, message: 'message'): yield from bot.post( message['channel'], message['text'] )

b = Bot('slack-bot-key') b.listen(echo)

butterfield.run(b)


Running the above code will result in this error: Future/Task exception was never retrieved Traceback (most recent call last): File "/home/ingard/slackbot/venv33/lib/python3.3/site-packages/asyncio/tasks.py", line 238, in _step result = next(coro) File "bleh.py", line 22, in ping if 'text' not in message: KeyError: 'text'

.. when for instance our incoming nagios webhook posts. It doesnt have the 'text' key but rather 'attachment'

ingardm avatar Jun 09 '15 08:06 ingardm