Skip to content

Instantly share code, notes, and snippets.

@DazWorrall
Created January 30, 2014 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DazWorrall/8714093 to your computer and use it in GitHub Desktop.
Save DazWorrall/8714093 to your computer and use it in GitHub Desktop.
Just a quick play getting messages into chatrooms over HTTP user errbot (https://github.com/gbin/err)
[Core]
Name = WebTest
Module = webtest
[Documentation]
Description = Testing!
from errbot import BotPlugin
from errbot.builtins.webserver import webhook
import logging
class WebTest(BotPlugin):
@webhook
def test(self, incoming_request):
logging.critical(repr(incoming_request))
return str(dir(self))
@webhook
def pm(self, incoming_request):
logging.critical(repr(incoming_request))
dest = incoming_request.get('dest')
msg = incoming_request.get('msg')
self.send(dest, msg)
return str(incoming_request)
@webhook
def muc(self, request):
logging.critical(repr(request))
dest = request.get('dest')
msg = request.get('msg')
self.send(dest, msg, message_type='groupchat')
return str(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment