Skip to content

Commit

Permalink
link can be used without arguments. 9gag deleted and implemented as link
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilhem Saurel committed Mar 19, 2016
1 parent 7ad3aef commit c07596e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
17 changes: 0 additions & 17 deletions 9gag/__init__.py

This file was deleted.

11 changes: 8 additions & 3 deletions link/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import os
import ConfigParser
import os

from pipobot.lib.modules import MultiSyncModule, defaultcmd
from pipobot.lib.utils import check_url

Expand Down Expand Up @@ -32,6 +33,10 @@ def readconf(self, bot):

@defaultcmd
def answer(self, cmd, sender, message):
url = self.dico[cmd]['url']
if message:
return check_url(self.dico[cmd]['url'].replace('KEYWORDS', message).replace(' ', '+').encode('utf-8'), geturl=True)
return "rtfm ;)"
if 'KEYWORDS' in url:
url = url.replace('KEYWORDS', message).replace(' ', '+')
else:
return _("This command does not take arguments")
return check_url(url.encode('utf-8'), geturl=True)
4 changes: 4 additions & 0 deletions link/urllist.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ url: http://www.downforeveryoneorjustme.com/KEYWORDS
[github]
desc: github's advanced search
url: https://github.com/search?q=KEYWORDS
[9gag]
desc: 9gag random page
url: http://9gag.com/random

0 comments on commit c07596e

Please sign in to comment.