Update help of module using keywords
This commit is contained in:
parent
979f1d0c55
commit
8ff0b626a2
|
@ -109,10 +109,14 @@ def parseresponse(msg):
|
|||
# MODULE INTERFACE ####################################################
|
||||
|
||||
@hook("cmd_hook", "framalink",
|
||||
help="Reduce any given URL",
|
||||
help_usage={None: "Reduce the last URL said on the channel",
|
||||
"[@provider=framalink] URL [URL ...]": "Reduce the given "
|
||||
"URL(s) using the specified shortner"})
|
||||
help="Reduce any long URL",
|
||||
help_usage={
|
||||
None: "Reduce the last URL said on the channel",
|
||||
"URL [URL ...]": "Reduce the given URL(s)"
|
||||
},
|
||||
keywords={
|
||||
"provider=SMTH": "Change the service provider used (by default: %s) among %s" % (DEFAULT_PROVIDER, ", ".join(PROVIDERS.keys()))
|
||||
})
|
||||
def cmd_reduceurl(msg):
|
||||
minify = list()
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
"""Postal tracking module"""
|
||||
|
||||
# PYTHON STUFF ############################################
|
||||
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
from bs4 import BeautifulSoup
|
||||
|
@ -8,11 +12,9 @@ from nemubot.exception import IMException
|
|||
from nemubot.tools.web import getURLContent
|
||||
from more import Response
|
||||
|
||||
nemubotversion = 4.0
|
||||
|
||||
# POSTAGE SERVICE PARSERS ############################################
|
||||
|
||||
|
||||
def get_tnt_info(track_id):
|
||||
data = getURLContent('www.tnt.fr/public/suivi_colis/recherche/'
|
||||
'visubontransport.do?bonTransport=%s' % track_id)
|
||||
|
@ -101,7 +103,6 @@ def get_laposte_info(laposte_id):
|
|||
|
||||
# TRACKING HANDLERS ###################################################
|
||||
|
||||
|
||||
def handle_tnt(tracknum):
|
||||
info = get_tnt_info(tracknum)
|
||||
if info:
|
||||
|
@ -141,23 +142,26 @@ def handle_coliprive(tracknum):
|
|||
if info:
|
||||
return ("Colis Privé: \x02%s\x0F : \x02%s\x0F." % (tracknum, info))
|
||||
|
||||
|
||||
TRACKING_HANDLERS = {
|
||||
'laposte': handle_laposte,
|
||||
'colissimo': handle_colissimo,
|
||||
'chronopost': handle_chronopost,
|
||||
'coliprive': handle_coliprive,
|
||||
'tnt': handle_tnt
|
||||
'tnt': handle_tnt,
|
||||
}
|
||||
|
||||
|
||||
# HOOKS ##############################################################
|
||||
|
||||
|
||||
@hook("cmd_hook", "track",
|
||||
help="Track postage",
|
||||
help_usage={"[@tracker] TRACKING_ID [TRACKING_ID ...]": "Track the "
|
||||
"specified postage IDs using the specified tracking service "
|
||||
"or all of them."})
|
||||
help="Track postage delivery",
|
||||
help_usage={
|
||||
"TRACKING_ID [...]": "Track the specified postage IDs on various tracking services."
|
||||
},
|
||||
keywords={
|
||||
"tracker=TRK": "Precise the tracker (default: all) among: " + ', '.join(TRACKING_HANDLERS)
|
||||
})
|
||||
def get_tracking_info(msg):
|
||||
if not len(msg.args):
|
||||
raise IMException("Renseignez un identifiant d'envoi.")
|
||||
|
|
Loading…
Reference in New Issue
Block a user