In some modules, raise ImportError to avoid module loading on errors

This commit is contained in:
nemunaire 2015-06-03 22:07:06 +02:00
parent 2e55ba5671
commit d95de8c195
10 changed files with 108 additions and 113 deletions

View file

@ -12,7 +12,7 @@ from nemubot.hooks import hook
from nemubot.tools import web
from nemubot.tools.web import striphtml
nemubotversion = 3.4
nemubotversion = 4.0
from more import Response
@ -23,12 +23,12 @@ def help_full():
@hook("cmd_hook", "tcode")
def cmd_tcode(msg):
if len(msg.cmds) != 2:
if not len(msg.args):
raise IRCException("indicate a transaction code or "
"a keyword to search!")
url = ("http://www.tcodesearch.com/tcodes/search?q=%s" %
urllib.parse.quote(msg.cmds[1]))
urllib.parse.quote(msg.args[0]))
page = web.getURLContent(url)
soup = BeautifulSoup(page)