summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-03-01 19:25:31 +0100
committermathieui <mathieui@mathieui.net>2013-03-01 19:25:31 +0100
commite1956533a6e04d7ba2afdbc841b48804a84120b3 (patch)
treefc2e61bacc68adc9d0c5382a4797018db1223eab /plugins
parent43c93a0a1b84c87b587174c49753b036f42672cd (diff)
downloadpoezio-e1956533a6e04d7ba2afdbc841b48804a84120b3.tar.gz
poezio-e1956533a6e04d7ba2afdbc841b48804a84120b3.tar.bz2
poezio-e1956533a6e04d7ba2afdbc841b48804a84120b3.tar.xz
poezio-e1956533a6e04d7ba2afdbc841b48804a84120b3.zip
Fix #2231 (update the plugins to use the new help system)
And fix some imprecisions/mistakes in the help.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/admin.py40
-rw-r--r--plugins/ai.py177
-rw-r--r--plugins/alias.py16
-rw-r--r--plugins/amsg.py5
-rw-r--r--plugins/display_corrections.py7
-rw-r--r--plugins/exec.py5
-rw-r--r--plugins/gpg/__init__.py6
-rw-r--r--plugins/link.py8
-rw-r--r--plugins/mpd_client.py9
-rw-r--r--plugins/otr.py6
-rw-r--r--plugins/pacokick.py5
-rw-r--r--plugins/ping.py20
-rw-r--r--plugins/quote.py9
-rw-r--r--plugins/reminder.py17
-rw-r--r--plugins/send_delayed.py9
-rw-r--r--plugins/status.py20
-rw-r--r--plugins/tell.py10
-rw-r--r--plugins/uptime.py5
18 files changed, 137 insertions, 237 deletions
diff --git a/plugins/admin.py b/plugins/admin.py
index cb9ee37b..0f61007b 100644
--- a/plugins/admin.py
+++ b/plugins/admin.py
@@ -13,28 +13,40 @@ class Plugin(BasePlugin):
/noaffiliation
"""
def init(self):
- for role in ['visitor', 'participant' , 'moderator']:
+ for role in ('visitor', 'participant' , 'moderator'):
self.add_tab_command(MucTab, role, self.role(role),
- '/%s <nick>\n%s: Set the role of a nick to %s.' %
- (role, role.capitalize(), role), self.complete_nick)
+ help='Set the role of a nick to %s' % role,
+ usage= '<nick>',
+ short='Set the role to %s' % role,
+ completion=self.complete_nick)
- for aff in ['member', 'owner', 'admin']:
+ for aff in ('member', 'owner', 'admin'):
self.add_tab_command(MucTab, aff, self.affiliation(aff),
- '/%s <nick>\n%s: set the affiliation of a nick to %s' %
- (aff, aff.capitalize(), aff), self.complete_nick)
+ usage='<nick>',
+ help='Set the affiliation of a nick to %s' % aff,
+ short='Set the affiliation to %s' % aff,
+ completion=self.complete_nick)
self.add_tab_command(MucTab, 'noaffiliation', self.affiliation('none'),
- '/noaffiliation <nick>\nNoAffiliation: set the affiliation of a nick to none.',
- self.complete_nick)
+ usage='<nick>',
+ help='Set the affiliation of a nick to none.',
+ short='Set the affiliation to none.',
+ completion=self.complete_nick)
self.add_tab_command(MucTab, 'voice', self.affiliation('member'),
- '/voice <nick>\nVoice: set the affiliation of a nick to member.',
- self.complete_nick)
+ usage='<nick>',
+ help='Set the affiliation of a nick to member.',
+ short='Set the affiliation to member.',
+ completion=self.complete_nick)
self.add_tab_command(MucTab, 'op', self.role('moderator'),
- '/op <nick>\nOp: set the role of a nick to moderator.',
- self.complete_nick)
+ usage='<nick>',
+ help='Set the role of a nick to moderator.',
+ short='Set the role to moderator.',
+ completion=self.complete_nick)
self.add_tab_command(MucTab, 'mute', self.role('visitor'),
- '/mute <nick>\nMute: set the role of a nick to visitor.',
- self.complete_nick)
+ usage='<nick>',
+ help='Set the role of a nick to visitor.',
+ short='Set the role to visitor.',
+ completion=self.complete_nick)
def role(self, role):
return lambda args: self.core.current_tab().command_role(args+' '+role)
diff --git a/plugins/ai.py b/plugins/ai.py
deleted file mode 100644
index 62ae2a96..00000000
--- a/plugins/ai.py
+++ /dev/null
@@ -1,177 +0,0 @@
-"""
-Recreational plugin.
-
-Message parser that can generate sentences based on what he has already seen
-before.
-
-"""
-from plugin import BasePlugin
-from random import choice
-from re import split as rsplit
-import pickle
-import tabs
-
-class Dico(object):
- def __init__(self):
- self.start_words = []
- self.end_words = []
- self.words = {}
-
- def add_next(self, word, next):
- w = self.words[word]
- if next in w:
- w[next] += 1
- else:
- w[next] = 1
-
- def add_word(self, word):
- if not word in self.words:
- self.words[word] = {}
-
- def select_next(self, word):
- d = sorted(self.words[word], key=lambda w: self.words[word][w], reverse=True)
- if not d:
- return ''
- nexts = d[:10]
- for i in range(0, len(d) // 10):
- nexts.append(choice(d[9:]))
- return choice(nexts)
-
- def create_sentence(self, length):
- if not self.start_words:
- return ''
- current = choice(self.start_words)
- i = 1
- sent = current.capitalize()
- while current and self.words[current] and i < length:
- current = self.select_next(current)
- sent += " " + current
- i += 1
- return sent
-
- def save(self, fname):
- file = open(fname, 'wb')
- pickle.dump(self, file)
- file.close
-
-spaces = '  '
-end_sentence = ['.', '?', '!']
-
-def end_re():
- r = '('
- for i in end_sentence[:]:
- end_sentence.append('%s ' % i)
- i = '\%s'% i
- r += '%s$|%s |' % (i, i)
- r = r[:-1]
- r += ')'
- return r
-
-end = end_re()
-
-
-class Analyzer(object):
- dico = None
- def __init__(self):
- pass
-
- def parse(self, text):
- text = text.replace('\n', '')
- res = rsplit(end, text)
- for i in res[:]:
- if i == '':
- continue
- elif i in end_sentence:
- continue
- self.analyze(i)
-
- def analyze(self, text):
- prev = None
- for word in rsplit('[%s]'%spaces, text):
- if word in spaces: continue
- word = word.lower()
- self.dico.add_word(word)
- if prev:
- self.dico.add_next(prev, word)
- else:
- self.dico.start_words.append(word)
- prev = word
-
-class Plugin(BasePlugin):
- def init(self):
- self.add_event_handler('groupchat_message', self.on_groupchat_message)
- self.add_tab_command(tabs.MucTab, 'random', self.command_random, '/random [n]\nRandom: Send a random message, if n is provided and is integer > 1, the message will have a maximum number of n words', None)
- self.add_tab_command(tabs.MucTab, 'start', self.command_start, '/start\nStart: Start parsing the messages', None)
- self.add_tab_command(tabs.MucTab, 'stop', self.command_stop, '/stop\nStop: Stop parsing the messages', None)
- self.add_tab_command(tabs.MucTab, 'flush', self.command_flush, '/flush\nFlush: Flush the database', None)
- self.add_tab_command(tabs.MucTab, 'save', self.command_save, '/save <filepath>\nSave: Save the database to a file', None)
- self.add_tab_command(tabs.MucTab, 'load_db', self.command_load_db, '/load_db <filepath>\nLoad: Load the database from a file', None)
- self.tabs = {}
- self.analyzer = Analyzer()
-
- def command_start(self, arg):
- name = self.core.current_tab().get_name()
- if not name in self.tabs:
- self.tabs[name] = Dico()
- self.core.information('Started analyzing in %s' % name, 'Info')
- else:
- self.core.information('Already started', 'Info')
-
- def command_stop(self, arg):
- name = self.core.current_tab().get_name()
- if name in self.tabs:
- del self.tabs[name]
- self.core.information('Stopped analyzing in %s' % name, 'Info')
- else:
- self.core.information('Nothing to stop', 'Info')
-
- def command_save(self, arg):
- name = self.core.current_tab().get_name()
- if name in self.tabs:
- try:
- self.tabs[name].save(arg)
- except:
- self.core.information('Could not save the file', 'Info')
- else:
- self.core.information('Nothing to save', 'Info')
-
- def command_flush(self, arg):
- name = self.core.current_tab().get_name()
- if name in self.tabs:
- del self.tabs[name]
- self.tabs[name] = Dico()
- self.core.information('Database flushed', 'Info')
- else:
- self.core.information('Nothing to flush', 'Info')
-
- def command_load_db(self, arg):
- name = self.core.current_tab().get_name()
- try:
- file = open(arg, 'rb')
- self.tabs[name] = pickle.load(file)
- file.close()
- self.core.information('File loaded', 'Info')
- except:
- self.core.information('Could not load the file', 'Info')
-
- def on_groupchat_message(self, message):
- if not message['body']:
- return
- jid = message['from']
- if jid.bare not in self.tabs or jid.resource == self.core.current_tab().own_nick:
- return
- jid = jid.bare
-
- self.analyzer.dico = self.tabs[jid]
- self.analyzer.parse(message['body'])
-
- def command_random(self, arg):
- name = self.core.current_tab().get_name()
- try:
- i = int(arg)
- if i < 1:
- i = 1
- except:
- i = 25
- if name in self.tabs:
- self.core.send_message(self.tabs[name].create_sentence(i))
diff --git a/plugins/alias.py b/plugins/alias.py
index 5a35d1c6..163e4c26 100644
--- a/plugins/alias.py
+++ b/plugins/alias.py
@@ -10,8 +10,15 @@ from common import parse_command_args_to_alias as parse
class Plugin(BasePlugin):
def init(self):
- self.add_command('alias', self.command_alias, '/alias <alias> <command> <args>\nAlias: create an alias command')
- self.add_command('unalias', self.command_unalias, '/unalias <alias>\nUnalias: remove a previously created alias')
+ self.add_command('alias', self.command_alias,
+ usage='<alias> <command> [args]',
+ short='Create an alias command',
+ help='Create an alias for <command> with [args].')
+ self.add_command('unalias', self.command_unalias,
+ usage='<alias>',
+ help='Remove a previously created alias',
+ short='Remove an alias',
+ completion=self.completion_unalias)
self.commands = {}
def command_alias(self, line):
@@ -42,6 +49,11 @@ class Plugin(BasePlugin):
self.del_command(alias)
self.core.information('Alias /%s successfuly deleted' % alias, 'Info')
+ def completion_unalias(self, the_input):
+ aliases = [alias for alias in self.commands]
+ aliases.sort()
+ return the_input.auto_completion(aliases, '', quotify=False)
+
def get_command(self, name):
"""Returns the function associated with a command"""
def dummy(args):
diff --git a/plugins/amsg.py b/plugins/amsg.py
index 697f793f..a002b11e 100644
--- a/plugins/amsg.py
+++ b/plugins/amsg.py
@@ -5,7 +5,10 @@ from tabs import MucTab
class Plugin(BasePlugin):
def init(self):
- self.add_command('amsg', self.command_amsg, "Usage: /amsg <message>\nAmsg: Broadcast the message to all the joined rooms.")
+ self.add_command('amsg', self.command_amsg,
+ usage='<message>',
+ short='Broadcast a message',
+ help='Broadcast the message to all the joined rooms.')
def command_amsg(self, args):
for room in self.core.tabs:
diff --git a/plugins/display_corrections.py b/plugins/display_corrections.py
index 9937387f..6e122bfe 100644
--- a/plugins/display_corrections.py
+++ b/plugins/display_corrections.py
@@ -7,9 +7,12 @@ import tabs
class Plugin(BasePlugin):
def init(self):
- usage = 'Usage: /display_corrections <number>\nDisplay_corrections: display all the corrections of the number-th last corrected message.'
for tab_type in (tabs.MucTab, tabs.PrivateTab, tabs.ConversationTab):
- self.add_tab_command(tab_type, 'display_corrections', self.command_display_corrections, usage)
+ self.add_tab_command(tab_type, 'display_corrections',
+ handler=self.command_display_corrections,
+ usage='<number>',
+ help='Display all the corrections of the number-th last corrected message.',
+ short='Display the corrections of a message')
def find_corrected(self, nb):
messages = self.core.get_conversation_messages()
diff --git a/plugins/exec.py b/plugins/exec.py
index c729b555..bf7d7c38 100644
--- a/plugins/exec.py
+++ b/plugins/exec.py
@@ -8,7 +8,10 @@ import subprocess
class Plugin(BasePlugin):
def init(self):
- self.add_command('exec', self.command_exec, "Usage: /exec [-o|-O] <command>\nExec: Execute a shell command and prints the result in the information buffer. The command should be ONE argument, that means it should be between \"\". The first argument (before the command) can be -o or -O. If -o is specified, it sends the result in the current conversation. If -O is specified, it sends the command and its result in the current conversation.\nExample: /exec -O \"uptime\" will send “uptime\n20:36:19 up 3:47, 4 users, load average: 0.09, 0.13, 0.09” in the current conversation.")
+ self.add_command('exec', self.command_exec,
+ usage='[-o|-O] <command>',
+ help='Execute a shell command and prints the result in the information buffer. The command should be ONE argument, that means it should be between \"\". The first argument (before the command) can be -o or -O. If -o is specified, it sends the result in the current conversation. If -O is specified, it sends the command and its result in the current conversation.\nExample: /exec -O \"uptime\" will send “uptime\n20:36:19 up 3:47, 4 users, load average: 0.09, 0.13, 0.09” in the current conversation.',
+ short='Execute a command')
def command_exec(self, args):
args = common.shell_split(args)
diff --git a/plugins/gpg/__init__.py b/plugins/gpg/__init__.py
index a60cbbdb..9fa8ee13 100644
--- a/plugins/gpg/__init__.py
+++ b/plugins/gpg/__init__.py
@@ -56,7 +56,11 @@ class Plugin(BasePlugin):
self.add_event_handler('conversation_say_after', self.on_conversation_say)
self.add_event_handler('conversation_msg', self.on_conversation_msg)
- self.add_command('gpg', self.command_gpg, "Usage: /gpg <force|disable|setkey> [JID] [keyid]\nGpg: Force or disable gpg encryption with the fulljid of the current conversation. The setkey argument lets you associate a keyid with the given bare JID.", self.gpg_completion)
+ self.add_tab_command(ConversationTab, 'gpg', self.command_gpg,
+ usage='<force|disable|setkey> [jid] [keyid]',
+ help='Force or disable gpg encryption with the fulljid of the current conversation. The setkey argument lets you associate a keyid with the given bare JID.',
+ short='Manage the GPG status',
+ completion=self.gpg_completion)
ConversationTab.add_information_element('gpg', self.display_encryption_status)
def cleanup(self):
diff --git a/plugins/link.py b/plugins/link.py
index 427d718a..0d88fba2 100644
--- a/plugins/link.py
+++ b/plugins/link.py
@@ -12,9 +12,11 @@ url_pattern = re.compile(r'\b(http[s]?://(?:\S+))\b', re.I|re.U)
class Plugin(BasePlugin):
def init(self):
- self.add_tab_command(tabs.MucTab, 'link', self.command_link, "Usage: /link\nLink: opens the last link from the conversation into a browser.")
- self.add_tab_command(tabs.PrivateTab, 'link', self.command_link, "Usage: /link\nLink: opens the last link from the conversation into a browser.")
- self.add_tab_command(tabs.ConversationTab, 'link', self.command_link, "Usage: /link\nLink: opens the last link from the conversation into a browser.")
+ for _class in (tabs.MucTab, tabs.PrivateTab, tabs.ConversationTab):
+ self.add_tab_command(_class, 'link', self.command_link,
+ usage='[num]',
+ help='Opens the last link from the conversation into a browser.\nIf [num] is given, then it will open the num-th link displayed.',
+ short='Open links into a browser')
def find_link(self, nb):
messages = self.core.get_conversation_messages()
diff --git a/plugins/mpd_client.py b/plugins/mpd_client.py
index e71c8a5f..47bbdf29 100644
--- a/plugins/mpd_client.py
+++ b/plugins/mpd_client.py
@@ -8,9 +8,12 @@ import mpd
class Plugin(BasePlugin):
def init(self):
- self.add_tab_command(tabs.ConversationTab, 'mpd', self.command_mpd, "Usage: /mpd [full]\nMpd: sends a message showing the current song of an MPD instance. If full is provided, the message is more verbose.", self.completion_mpd)
- self.add_tab_command(tabs.MucTab, 'mpd', self.command_mpd, "Usage: /mpd [full]\nMpd: sends a message showing the current song of an MPD instance. If full is provided, the message is more verbose.", self.completion_mpd)
- self.add_tab_command(tabs.PrivateTab, 'mpd', self.command_mpd, "Usage: /mpd [full]\nMpd: sends a message showing the current song of an MPD instance. If full is provided, the message is more verbose.", self.completion_mpd)
+ for _class in (tabs.ConversationTab, tabs.MucTab, tabs.PrivateTab):
+ self.add_tab_command(_class, 'mpd', self.command_mpd,
+ usage='[full]',
+ help='Sends a message showing the current song of an MPD instance. If full is provided, the message is more verbose.',
+ short='Send the MPD status',
+ completion=self.completion_mpd)
def command_mpd(self, args):
args = shell_split(args)
diff --git a/plugins/otr.py b/plugins/otr.py
index 51e9a8d4..f3a1d7a2 100644
--- a/plugins/otr.py
+++ b/plugins/otr.py
@@ -16,7 +16,11 @@ class Plugin(BasePlugin):
self.add_event_handler('conversation_say_after', self.on_conversation_say)
self.add_event_handler('conversation_msg', self.on_conversation_msg)
- self.add_tab_command(ConversationTab, 'otr', self.command_otr, "Usage: /otr <start|end>\notr: Start or stop OTR for the current conversation", self.otr_completion)
+ self.add_tab_command(ConversationTab, 'otr', self.command_otr,
+ usage='<start|end|fpr>',
+ help='Start or stop OTR for the current conversation.',
+ short='Manage OTR status',
+ completion=self.otr_completion)
ConversationTab.add_information_element('otr', self.display_encryption_status)
def cleanup(self):
diff --git a/plugins/pacokick.py b/plugins/pacokick.py
index 3ecef7a8..053e6c22 100644
--- a/plugins/pacokick.py
+++ b/plugins/pacokick.py
@@ -5,7 +5,10 @@ from plugin import BasePlugin
class Plugin(BasePlugin):
def init(self):
- self.add_command('pacokick', self.command_kick, '/pacokick <nick> [reason]\nPacokick: kick a random user.')
+ self.add_command('pacokick', self.command_kick,
+ usage='',
+ help='Kick a random user.',
+ short='Kick a random user')
def command_kick(self, arg):
tab = self.core.current_tab()
diff --git a/plugins/ping.py b/plugins/ping.py
index fdecd8e0..22401a25 100644
--- a/plugins/ping.py
+++ b/plugins/ping.py
@@ -8,10 +8,22 @@ import tabs
class Plugin(BasePlugin):
def init(self):
self.core.xmpp.register_plugin('xep_0199')
- self.add_command('ping', self.command_ping, '/ping <jid>\nPing: Send a XMPP ping to jid (see XEP-0199).', self.completion_ping)
- self.add_tab_command(tabs.MucTab, 'ping', self.command_muc_ping, '/ping <jid or nick>\nPing: Send a XMPP ping to jid or nick (see XEP-0199)', self.completion_muc_ping)
- self.add_tab_command(tabs.PrivateTab, 'ping', self.command_private_ping, '/ping\nPing: Send a XMPP ping to the current interlocutor (see XEP-0199)')
- self.add_tab_command(tabs.ConversationTab, 'ping', self.command_private_ping, '/ping\nPing: Send a XMPP ping to the current interlocutor (see XEP-0199)', self.completion_ping)
+ self.add_command('ping', self.command_ping,
+ usage='<jid>',
+ help='Send a XMPP ping to jid (see XEP-0199).',
+ short='Send a ping',
+ completion=self.completion_ping)
+ self.add_tab_command(tabs.MucTab, 'ping', self.command_muc_ping,
+ usage='<jid|nick>',
+ help='Send a XMPP ping to jid or nick (see XEP-0199).',
+ short='Send a ping.',
+ completion=self.completion_muc_ping)
+ for _class in (tabs.PrivateTab, tabs.ConversationTab):
+ self.add_tab_command(_class, 'ping', self.command_private_ping,
+ usage='[jid]',
+ help='Send a XMPP ping to the current interlocutor or the given JID.',
+ short='Send a ping',
+ completion=self.completion_ping)
def command_ping(self, arg):
if not arg:
diff --git a/plugins/quote.py b/plugins/quote.py
index 50c390f2..ebd9b15e 100644
--- a/plugins/quote.py
+++ b/plugins/quote.py
@@ -12,9 +12,12 @@ log = logging.getLogger(__name__)
class Plugin(BasePlugin):
def init(self):
- self.add_tab_command(tabs.MucTab, 'quote', self.command_quote, "Usage: /quote <timestamp>\nQuote: takes the message received at <timestamp> and insert it in the input, to quote it.", self.completion_quote)
- self.add_tab_command(tabs.ConversationTab, 'quote', self.command_quote, "Usage: /quote <timestamp>\nQuote: takes the message received at <timestamp> and insert it in the input, to quote it.", self.completion_quote)
- self.add_tab_command(tabs.PrivateTab, 'quote', self.command_quote, "Usage: /quote <timestamp>\nQuote: takes the message received at <timestamp> and insert it in the input, to quote it.", self.completion_quote)
+ for _class in (tabs.MucTab, tabs.ConversationTab, tabs.PrivateTab):
+ self.add_tab_command(_class, 'quote', self.command_quote,
+ usage='<timestamp>',
+ help='Takes the message received at <timestamp> and insert it in the input, to quote it.',
+ short='Quote a message from a timestamp',
+ completion=self.completion_quote)
def command_quote(self, args):
args = common.shell_split(args)
diff --git a/plugins/reminder.py b/plugins/reminder.py
index 2e3fd20d..03711906 100644
--- a/plugins/reminder.py
+++ b/plugins/reminder.py
@@ -6,9 +6,20 @@ import timed_events
class Plugin(BasePlugin):
def init(self):
- self.add_command('remind', self.command_remind, "Usage: /remind <time in seconds> <todo>\nReminder: remind you of <todo> every <time> seconds..", self.completion_remind)
- self.add_command('done', self.command_done, "Usage: /done <id>\nDone: Stop reminding you do the task identified by <id>", self.completion_done)
- self.add_command('tasks', self.command_tasks, "Usage: /tasks\nTasks: List all the current tasks and their ids.", None)
+ self.add_command('remind', self.command_remind,
+ usage='<seconds> <todo>',
+ help='Remind you of <todo> every <time> seconds.',
+ short='Remind you of a task',
+ completion=self.completion_remind)
+ self.add_command('done', self.command_done,
+ usage='<id>',
+ help='Stop reminding you do the task identified by <id>.',
+ short='Remove a task',
+ completion=self.completion_done)
+ self.add_command('tasks', self.command_tasks,
+ usage='',
+ help='List all the current tasks and their ids.',
+ short='List current tasks')
self.tasks = {}
self.count = 0
diff --git a/plugins/send_delayed.py b/plugins/send_delayed.py
index 61d2d397..253bb027 100644
--- a/plugins/send_delayed.py
+++ b/plugins/send_delayed.py
@@ -6,9 +6,12 @@ import timed_events
class Plugin(BasePlugin):
def init(self):
- self.add_tab_command(tabs.PrivateTab, 'send_delayed', self.command_delayed, "Usage: /send_delayed <delay> <message>\nSend Delayed: Send <message> with a delay of <delay> seconds.", self.completion_delay)
- self.add_tab_command(tabs.MucTab, 'send_delayed', self.command_delayed, "Usage: /send_delayed <delay> <message>\nSend Delayed: Send <message> with a delay of <delay> seconds.", self.completion_delay)
- self.add_tab_command(tabs.ConversationTab, 'send_delayed', self.command_delayed, "Usage: /send_delayed <delay> <message>\nSend Delayed: Send <message> with a delay of <delay> seconds.", self.completion_delay)
+ for _class in (tabs.PrivateTab, tabs.ConversationTab, tabs.MucTab):
+ self.add_tab_command(_class, 'send_delayed', self.command_delayed,
+ usage='<delay> <message>',
+ help='Send <message> with a delay of <delay> seconds.',
+ short='Send a message later',
+ completion=self.completion_delay)
def command_delayed(self, arg):
args = common.shell_split(arg)
diff --git a/plugins/status.py b/plugins/status.py
index 68f126c1..fa296c7b 100644
--- a/plugins/status.py
+++ b/plugins/status.py
@@ -5,17 +5,9 @@ class Plugin(BasePlugin):
Adds several convenient aliases to /status command
"""
def init(self):
- self.add_command('dnd', lambda line: self.core.command_status('dnd "'+line+'"'),
- '/dnd [status message]\nDnd: Set your status as dnd (do not disturb).')
- self.add_command('busy', lambda line: self.core.command_status('busy "'+line+'"'),
- '/busy [status message]\nBusy: Set your status as busy.')
- self.add_command('chat', lambda line: self.core.command_status('chat "'+line+'"'),
- '/chat [status message]\nChat: Set your status as chatty.')
- self.add_command('xa', lambda line: self.core.command_status('xa "'+line+'"'),
- '/xa [status message]\nXa: Set your status as xa (eXtended away).')
- self.add_command('afk', lambda line: self.core.command_status('afk "'+line+'"'),
- '/afk [status message]\nAfk: Set your status as afk (away from keyboard).')
- self.add_command('away', lambda line: self.core.command_status('away "'+line+'"'),
- '/away [status message]\nAway: Set your status as away.')
- self.add_command('available', lambda line: self.core.command_status('available "'+line+'"'),
- '/available [status message]\nAvailable: Set your status as available.')
+ for st in ('dnd', 'busy', 'afk', 'chat', 'xa', 'away', 'available'):
+ self.add_command(st,
+ lambda line: self.core.command_status(st + ' "'+line+'"'),
+ usage='[status message]',
+ short='Set your status as %s' % st,
+ help='Set your status as %s' % st)
diff --git a/plugins/tell.py b/plugins/tell.py
index bcb488b7..f2ed49c8 100644
--- a/plugins/tell.py
+++ b/plugins/tell.py
@@ -5,10 +5,14 @@ import common
class Plugin(BasePlugin):
def init(self):
self.add_tab_command(tabs.MucTab, 'tell', self.command_tell,
- '/tell <nick> <message>\nTell: will tell <nick> of <message> when he next joins.')
+ usage='<nick> <message>',
+ help='Will tell <nick> of <message> when he next joins.',
+ short='Send a message when someone joins')
self.add_tab_command(tabs.MucTab, 'untell', self.command_untell,
- '/untell <nick>\nUntell: will remove the saved messages from /tell.',
- self.completion_untell)
+ usage='<nick>',
+ help='Remove the planned messages from /tell.',
+ short='Cancel a /tell message',
+ completion=self.completion_untell)
self.add_event_handler('muc_join', self.on_join)
# {tab -> {nick -> [messages]}
self.tabs = {}
diff --git a/plugins/uptime.py b/plugins/uptime.py
index ca79ce84..5390f9f7 100644
--- a/plugins/uptime.py
+++ b/plugins/uptime.py
@@ -6,7 +6,10 @@ from sleekxmpp.xmlstream.stanzabase import JID
class Plugin(BasePlugin):
def init(self):
- self.add_command('uptime', self.command_uptime, '/uptime [jid]\nUptime: Ask for the uptime of a server or component (see XEP-0012).', None)
+ self.add_command('uptime', self.command_uptime,
+ usage='<jid>',
+ help='Ask for the uptime of a server or component (see XEP-0012).',
+ short='Get the uptime')
def command_uptime(self, arg):
def callback(iq):