From cd7843e16e3439192a8217a8fde27f17cba2c59a Mon Sep 17 00:00:00 2001 From: nemunaire Date: Thu, 28 Aug 2014 01:39:31 +0200 Subject: [PATCH] Replace help_tiny by module docstring --- bot.py | 2 +- modules/alias.py | 6 ++---- modules/birthday.py | 7 ++----- modules/bonneannee.py | 2 ++ modules/conjugaison.py | 5 ++--- modules/ddg/__init__.py | 2 ++ modules/events.py | 6 ++---- modules/github.py | 6 ++---- modules/imdb.py | 5 ++--- modules/networking.py | 6 ++---- modules/nextstop/__init__.py | 6 ++---- modules/reddit.py | 6 ++---- modules/rnd.py | 2 ++ modules/sap.py | 5 ++--- modules/sleepytime.py | 6 ++---- modules/sms.py | 6 ++---- modules/spell/__init__.py | 5 ++--- modules/syno.py | 5 ++--- modules/translate.py | 6 ++---- modules/velib.py | 6 ++---- modules/watchWebsite/__init__.py | 6 ++---- modules/weather.py | 6 ++---- modules/worldcup.py | 6 ++---- modules/ycc.py | 6 ++---- 24 files changed, 47 insertions(+), 77 deletions(-) diff --git a/bot.py b/bot.py index 1e24087..7aeaf01 100644 --- a/bot.py +++ b/bot.py @@ -608,7 +608,7 @@ def _help_msg(sndr, modules, cmd): res.append_message(title="Pour plus de détails sur un module, " "envoyez \"!help nomdumodule\". Voici la liste" " de tous les modules disponibles localement", - message=["\x03\x02%s\x03\x02 (%s)" % (im, modules[im].help_tiny ()) for im in modules if hasattr(modules[im], "help_tiny")]) + message=["\x03\x02%s\x03\x02 (%s)" % (im, modules[im].__doc__) for im in modules if modules[im].__doc__]) return res def hotswap(bak): diff --git a/modules/alias.py b/modules/alias.py index 8b8eea6..7d83d3b 100644 --- a/modules/alias.py +++ b/modules/alias.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Create alias of commands""" + import re import sys from datetime import datetime @@ -19,10 +21,6 @@ def load(context): DATAS.getNode("variables").setIndex("name") -def help_tiny (): - """Line inserted in the response to the command !help""" - return "alias module" - def help_full (): return "TODO" diff --git a/modules/birthday.py b/modules/birthday.py index f58697c..cfb2ffa 100644 --- a/modules/birthday.py +++ b/modules/birthday.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""People birthdays and ages""" + import re import sys from datetime import datetime @@ -15,11 +17,6 @@ def load(context): DATAS.setIndex("name", "birthday") -def help_tiny(): - """Line inserted in the response to the command !help""" - return "People birthdays and ages" - - def help_full(): return "!anniv /who/: gives the remaining time before the anniversary of /who/\n!age /who/: gives the age of /who/\nIf /who/ is not given, gives the remaining time before your anniversary.\n\n To set yout birthday, say it to nemubot :)" diff --git a/modules/bonneannee.py b/modules/bonneannee.py index 2d08038..4f2868d 100644 --- a/modules/bonneannee.py +++ b/modules/bonneannee.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Wishes Happy New Year when the time comes""" + from datetime import datetime from hooks import hook diff --git a/modules/conjugaison.py b/modules/conjugaison.py index f8838df..9d9c492 100644 --- a/modules/conjugaison.py +++ b/modules/conjugaison.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Find french conjugaison""" + import re import traceback import sys @@ -28,9 +30,6 @@ d = defaultdict(list) for k, v in s: d[k].append(v) -def help_tiny(): - return "Find french conjugaison" - def help_full(): return "!conjugaison : give the conjugaison for in ." diff --git a/modules/ddg/__init__.py b/modules/ddg/__init__.py index 6896df4..18f01c9 100644 --- a/modules/ddg/__init__.py +++ b/modules/ddg/__init__.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Search around various search engine or knowledges database""" + import imp from hooks import hook diff --git a/modules/events.py b/modules/events.py index 193cca7..5a745fb 100644 --- a/modules/events.py +++ b/modules/events.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Create countdowns and reminders""" + import imp import re import sys @@ -14,10 +16,6 @@ nemubotversion = 3.4 from event import ModuleEvent from hooks import Hook, hook -def help_tiny (): - """Line inserted in the response to the command !help""" - return "events manager" - def help_full (): return "This module store a lot of events: ny, we, " + (", ".join(DATAS.index.keys())) + "\n!eventslist: gets list of timer\n!start /something/: launch a timer" diff --git a/modules/github.py b/modules/github.py index 23b6b3e..220c407 100644 --- a/modules/github.py +++ b/modules/github.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Repositories, users or issues on GitHub""" + import json import re import urllib.error @@ -10,10 +12,6 @@ from hooks import hook nemubotversion = 3.4 -def help_tiny (): - """Line inserted in the response to the command !help""" - return "The GitHub module" - def help_full (): return "!github /repo/: Display information about /repo/.\n!github_user /user/: Display information about /user/." diff --git a/modules/imdb.py b/modules/imdb.py index 2324cd6..26b40a3 100644 --- a/modules/imdb.py +++ b/modules/imdb.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Show many information about a movie or serie""" + import json import re import urllib.request @@ -8,9 +10,6 @@ from hooks import hook nemubotversion = 3.4 -def help_tiny (): - return "Show many information about a movie or serie" - def help_full (): return "Search a movie title with: !imdbs ; View movie details with !imdb " diff --git a/modules/networking.py b/modules/networking.py index 7536063..5572320 100644 --- a/modules/networking.py +++ b/modules/networking.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Various network tools (w3m, w3c validator, curl, traceurl, ...)""" + import datetime import http.client import json @@ -21,10 +23,6 @@ def load(context): else: add_hook("cmd_hook", Hook(cmd_whois, "netwhois")) -def help_tiny(): - """Line inserted in the response to the command !help""" - return "The networking module" - def help_full(): return "!traceurl /url/: Follow redirections from /url/." diff --git a/modules/nextstop/__init__.py b/modules/nextstop/__init__.py index 6875239..36838ca 100644 --- a/modules/nextstop/__init__.py +++ b/modules/nextstop/__init__.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Informe les usagers des prochains passages des transports en communs de la RATP""" + import http.client import re from xml.dom.minidom import parseString @@ -13,10 +15,6 @@ def load(context): DATAS.setIndex("name", "station") -def help_tiny (): - """Line inserted in the response to the command !help""" - return "Informe les usagers des prochains passages des transports en communs de la RATP" - def help_full (): return "!ratp transport line [station]: Donne des informations sur les prochains passages du transport en commun séléctionné à l'arrêt désiré. Si aucune station n'est précisée, les liste toutes." diff --git a/modules/reddit.py b/modules/reddit.py index 3500aac..62b01ab 100644 --- a/modules/reddit.py +++ b/modules/reddit.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Get information about subreddit""" + import json import re import urllib @@ -8,10 +10,6 @@ nemubotversion = 3.4 from hooks import hook -def help_tiny(): - """Line inserted in the response to the command !help""" - return "The subreddit module" - def help_full(): return "!subreddit /subreddit/: Display information on the subreddit." diff --git a/modules/rnd.py b/modules/rnd.py index 812b88e..fc28b01 100644 --- a/modules/rnd.py +++ b/modules/rnd.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Help to make choice""" + import random from hooks import hook diff --git a/modules/sap.py b/modules/sap.py index 139a5ee..5b802d5 100644 --- a/modules/sap.py +++ b/modules/sap.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Find information about an SAP transaction codes""" + import urllib.request import json import re @@ -10,9 +12,6 @@ from tools.web import striphtml nemubotversion = 3.4 -def help_tiny (): - return "Find information about an SAP transaction codes" - def help_full (): return "!tcode <transaction code|keywords>" diff --git a/modules/sleepytime.py b/modules/sleepytime.py index 681ed42..cf45af6 100644 --- a/modules/sleepytime.py +++ b/modules/sleepytime.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""as http://sleepyti.me/, give you the best time to go to bed""" + import re import imp from datetime import datetime @@ -9,10 +11,6 @@ from hooks import hook nemubotversion = 3.4 -def help_tiny(): - """Line inserted in the response to the command !help""" - return "as http://sleepyti.me/, give you the best time to go to bed" - def help_full(): return "If you would like to sleep soon, use !sleepytime to know the best time to wake up; use !sleepytime hh:mm if you want to wake up at hh:mm" diff --git a/modules/sms.py b/modules/sms.py index 8fc8fb6..a0cfeba 100644 --- a/modules/sms.py +++ b/modules/sms.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Send SMS using SMS API (currently only Free Mobile)""" + import re import socket import time @@ -15,10 +17,6 @@ def load(context): global DATAS DATAS.setIndex("name", "phone") -def help_tiny(): - """Line inserted in the response to the command !help""" - return "Send SMS using SMS API (currently only Free Mobile)" - def help_full(): return "!sms /who/[,/who/[,...]] message: send a SMS to /who/." diff --git a/modules/spell/__init__.py b/modules/spell/__init__.py index 23bdda8..5426f73 100644 --- a/modules/spell/__init__.py +++ b/modules/spell/__init__.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Check words spelling""" + import re from urllib.parse import quote @@ -10,9 +12,6 @@ from .pyaspell import AspellError nemubotversion = 3.4 -def help_tiny(): - return "Check words spelling" - def help_full(): return "!spell [<lang>] <word>: give the correct spelling of <word> in <lang=fr>." diff --git a/modules/syno.py b/modules/syno.py index 9916bc5..548d89f 100644 --- a/modules/syno.py +++ b/modules/syno.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Find french synonyms""" + import re import traceback import sys @@ -10,9 +12,6 @@ from tools import web nemubotversion = 3.4 -def help_tiny(): - return "Find french synonyms" - def help_full(): return "!syno <word>: give a list of synonyms for <word>." diff --git a/modules/translate.py b/modules/translate.py index 42b302a..8191d3b 100644 --- a/modules/translate.py +++ b/modules/translate.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Translation module""" + import http.client import re import socket @@ -30,10 +32,6 @@ def load(context): add_hook("cmd_hook", Hook(cmd_translate, "translate")) -def help_tiny(): - """Line inserted in the response to the command !help""" - return "Translation module" - def help_full(): return "!translate [lang] <term>[ <term>[...]]: Found translation of <term> from/to english to/from <lang>. Data © WordReference.com" diff --git a/modules/velib.py b/modules/velib.py index d21c4f7..3a4cfe8 100644 --- a/modules/velib.py +++ b/modules/velib.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Gets information about velib stations""" + import re from tools import web @@ -15,10 +17,6 @@ def load(context): # station_status) # context.add_event(evt) -def help_tiny (): - """Line inserted in the response to the command !help""" - return "Gets information about velib stations" - def help_full (): return "!velib /number/ ...: gives available bikes and slots at the station /number/." diff --git a/modules/watchWebsite/__init__.py b/modules/watchWebsite/__init__.py index dad1604..1e749dd 100644 --- a/modules/watchWebsite/__init__.py +++ b/modules/watchWebsite/__init__.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""Alert on changes on websites""" + from datetime import datetime from datetime import timedelta import http.client @@ -17,10 +19,6 @@ from .atom import Atom nemubotversion = 3.4 -def help_tiny (): - """Line inserted in the response to the command !help""" - return "Alert on changes on websites" - def help_full (): return "This module is autonomous you can't interract with it." diff --git a/modules/weather.py b/modules/weather.py index 3833756..cbb11b7 100644 --- a/modules/weather.py +++ b/modules/weather.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""The weather module""" + import datetime import json import re @@ -27,10 +29,6 @@ def load(context): add_hook("cmd_hook", Hook(cmd_coordinates, "coordinates")) -def help_tiny (): - """Line inserted in the response to the command !help""" - return "The weather module" - def help_full (): return "!weather /city/: Display the current weather in /city/." diff --git a/modules/worldcup.py b/modules/worldcup.py index a1628d2..c32b133 100644 --- a/modules/worldcup.py +++ b/modules/worldcup.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""The 2014 football worldcup module""" + import datetime import json import re @@ -19,10 +21,6 @@ def load(context): add_event(ModuleEvent(func=lambda url: urlopen(url, timeout=10).read().decode(), func_data=API_URL % "matches/current?by_date=DESC", call=current_match_new_action, intervalle=30)) -def help_tiny (): - """Line inserted in the response to the command !help""" - return "The 2014 football worldcup module" - def help_full (): return "!worldcup: do something." diff --git a/modules/ycc.py b/modules/ycc.py index 779cb84..fb2208e 100644 --- a/modules/ycc.py +++ b/modules/ycc.py @@ -1,5 +1,7 @@ # coding=utf-8 +"""URL reducer module""" + import re from urllib.parse import urlparse from urllib.parse import quote @@ -9,10 +11,6 @@ from hooks import hook nemubotversion = 3.4 -def help_tiny(): - """Line inserted in the response to the command !help""" - return "Gets YCC urls" - def help_full(): return "!ycc [<url>]: with an argument, reduce the given <url> thanks to ycc.fr; without argument, reduce the last URL said on the current channel."