Created
January 30, 2014 17:34
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Core] | |
Name = WebTest | |
Module = webtest | |
[Documentation] | |
Description = Testing! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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