Skip to content

Commit

Permalink
Adding TinyURL plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
1byte2bytes committed Mar 6, 2017
1 parent bc31ae1 commit ce8cd34
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugins/tinyurl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import plugin
import command
import message
from urllib.request import urlopen

def onInit(plugin):
tinyurl_command = command.command(plugin, 'tinyurl')
return plugin.plugin.plugin(plugin, 'tinyurl', [tinyurl_command])

def onCommand(message_in):
return message.create(body=urlopen("http://tinyurl.com/api-create.php?url=" + message_in.body.strip()).read().decode("utf-8"))

0 comments on commit ce8cd34

Please sign in to comment.