diff options
author | kongr45gpen <electrovesta@gmail.com> | 2014-04-27 23:31:24 +0300 |
---|---|---|
committer | kongr45gpen <electrovesta@gmail.com> | 2014-04-27 23:31:24 +0300 |
commit | a4445d2c8064d8099c09a54f08ad57f755f15a5f (patch) | |
tree | a62c0c3c4ce6a68808780b58325dcc43844e2e18 /local | |
parent | 44e5718b218b879d7cc5e83ad387e02b9668937e (diff) | |
download | supybot_github-a4445d2c8064d8099c09a54f08ad57f755f15a5f.tar.gz supybot_github-a4445d2c8064d8099c09a54f08ad57f755f15a5f.tar.bz2 supybot_github-a4445d2c8064d8099c09a54f08ad57f755f15a5f.zip |
Add testing command
Diffstat (limited to 'local')
-rw-r--r-- | local/handler/GithubHandler.py | 2 | ||||
-rw-r--r-- | local/utility.py | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/local/handler/GithubHandler.py b/local/handler/GithubHandler.py index 2b4096d..ed27a98 100644 --- a/local/handler/GithubHandler.py +++ b/local/handler/GithubHandler.py @@ -107,5 +107,7 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler): for msg in msgs: irc.queueMsg(ircmsgs.privmsg(channel, msg)) + saveMessages(msgs) + def log_message(self, format, *args): log.info(format % args) diff --git a/local/utility.py b/local/utility.py index 7c66d9e..abb0915 100644 --- a/local/utility.py +++ b/local/utility.py @@ -1,9 +1,12 @@ import urllib2 import supybot.conf as conf +import supybot.world as world import supybot.ircutils as ircutils import supybot.registry as registry +import globals + def registryValue(plugin, name, channel=None, value=True): group = conf.supybot.plugins.get(plugin) names = registry.split(name) @@ -62,6 +65,12 @@ def getShortURL(longurl): url = response.info().getheader('Location') return ircutils.mircColor(url, "purple") +def saveMessages(msgs): + """ Saves the last messages so that the plugin can be easily tested """ + if world.testing: + return + globals.messageList = msgs + # Possible colours: # white, black, (light/dark) blue, (light) green, red, brown, purple, # orange, yellow, teal, pink, light/dark gray/grey |