[laposte] handling no arguments

This commit is contained in:
Maxence 2015-05-24 11:06:37 +02:00 committed by nemunaire
parent 9120cf56c2
commit 481b1974c3

View File

@ -1,7 +1,9 @@
import urllib.request import urllib.request
import urllib.parse import urllib.parse
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from nemubot.hooks import hook from nemubot.hooks import hook
from nemubot.exception import IRCException
from more import Response from more import Response
nemubotversion = 3.4 nemubotversion = 3.4
@ -12,6 +14,9 @@ def help_full():
@hook("cmd_hook", "laposte") @hook("cmd_hook", "laposte")
def get_tracking_info(msg): def get_tracking_info(msg):
if len(msg.cmds) < 2:
raise IRCException("Renseignez un identifiant d'envoi,")
data = urllib.parse.urlencode({'id': msg.cmds[1]}) data = urllib.parse.urlencode({'id': msg.cmds[1]})
laposte_baseurl = "http://www.part.csuivi.courrier.laposte.fr/suivi/index" laposte_baseurl = "http://www.part.csuivi.courrier.laposte.fr/suivi/index"