master
Andrei M 2012-06-22 02:29:31 +03:00 committed by mutantmonkey
parent 251b01e000
commit 2c9a937c2e
1 changed files with 20 additions and 3 deletions

View File

@ -9,6 +9,7 @@ from tools import GrumbleError
import web
import json
def linx(phenny, input):
""".linx <url> - Upload a URL to linx.li."""
@ -30,8 +31,6 @@ def linx(phenny, input):
phenny.reply(data['url'])
linx.rule = (['linx'], r'(.*)')
if __name__ == '__main__':
print(__doc__.strip())
def lines(phenny, input):
""".lines <nickname> (<today/yesterday/YYYYMMDD>) - Returns the number of lines a user posted on a specific date."""
@ -62,5 +61,23 @@ def lines(phenny, input):
lines.rule = (['lines'], r'(.*)')
def posted(phenny, input):
""".posted <message> - Checks if <message> has already been posted."""
message = input.group(2)
if not message:
phenny.say(".posted <message> - Checks if <message> has already been posted.")
return
try:
req = web.post("http://linx.li/vtluugposted", {'message': message, 'sender': input.nick})
except (HTTPError, IOError):
raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.")
phenny.reply(req)
posted.rule = (['posted'], r'(.*)')
if __name__ == '__main__':
print(__doc__.strip())
print(__doc__.strip())