aboutsummaryrefslogtreecommitdiffstats
path: root/plugin.py
diff options
context:
space:
mode:
authorkongr45gpen <electrovesta@gmail.com>2014-04-27 23:31:24 +0300
committerkongr45gpen <electrovesta@gmail.com>2014-04-27 23:31:24 +0300
commita4445d2c8064d8099c09a54f08ad57f755f15a5f (patch)
treea62c0c3c4ce6a68808780b58325dcc43844e2e18 /plugin.py
parent44e5718b218b879d7cc5e83ad387e02b9668937e (diff)
downloadsupybot_github-a4445d2c8064d8099c09a54f08ad57f755f15a5f.tar.gz
supybot_github-a4445d2c8064d8099c09a54f08ad57f755f15a5f.tar.bz2
supybot_github-a4445d2c8064d8099c09a54f08ad57f755f15a5f.zip
Add testing command
Diffstat (limited to 'plugin.py')
-rw-r--r--plugin.py38
1 files changed, 36 insertions, 2 deletions
diff --git a/plugin.py b/plugin.py
index 75adadd..6985213 100644
--- a/plugin.py
+++ b/plugin.py
@@ -28,6 +28,7 @@
import re
import json
import time
+import Queue
import urllib
import urlparse
import threading
@@ -44,8 +45,12 @@ import supybot.ircutils as ircutils
import supybot.registry as registry
import supybot.callbacks as callbacks
-RequestHandler = utils.python.universalImport('handler.GithubHandler', 'local.handler.GithubHandler')
-Utility = utils.python.universalImport('local.utility')
+#RequestHandler = utils.python.universalImport('handler.GithubHandler', 'local.handler.GithubHandler')
+#Utility = utils.python.universalImport('local.utility')
+
+import local.globals as globals
+import local.handler.GithubHandler as RequestHandler
+import local.utility as Utility
class Github(callbacks.Plugin):
"""Add the help for \"@plugin help Github\" here
@@ -53,6 +58,7 @@ class Github(callbacks.Plugin):
threaded = True
port = Utility.configValue('port')
+ messages = []
pass
def ServerStart(self, httpd):
@@ -74,6 +80,7 @@ class Github(callbacks.Plugin):
def __call__(self, irc, msg):
self.__parent.__call__(irc, msg)
+
def die(self):
self.httpd.server_close()
self.httpd.shutdown()
@@ -81,6 +88,33 @@ class Github(callbacks.Plugin):
reload(RequestHandler)
reload(Utility)
+ def get(self, irc, msg, args, order, type, garbage):
+ """[<order>] [<type>] [<garbage>]
+ Returns the requested message generated by the request handler.
+ Examples: get first message, get 2nd last response
+ """
+ _digits = re.compile('\d')
+
+ orders = { 'first': 1,
+ 'second': 2,
+ 'third': 3,
+ 'fourth': 4
+ }
+
+ if _digits.search(order):
+ requestedNum = int(re.sub("[^0-9]", "", order))
+ else:
+ requestedNum = orders[order] if order in orders else 1
+
+ if order == 'last' or type == 'last':
+ requestedNum = len(globals.messageList) - requestedNum + 1
+
+ print globals.messageList
+ irc.reply(globals.messageList[requestedNum-1])
+
+ # Debug function
+ get = wrap(get, ['lowered', optional('lowered'), optional('text')]) if world.testing else False
+
Class = Github

© 2014-2024 Faster IT GmbH | imprint | privacy policy