瀏覽代碼

fix by moving aliases to help

tags/v0.1
Ben Kurtovic 13 年之前
父節點
當前提交
a7d8faa0a0
共有 2 個文件被更改,包括 12 次插入13 次删除
  1. +12
    -3
      irc/commands/help.py
  2. +0
    -10
      irc/triggers.py

+ 12
- 3
irc/commands/help.py 查看文件

@@ -2,10 +2,18 @@

"""Generates help information."""

from irc import triggers

connection, data = None, None

def get_alias(key):
"""connect command aliases with their file, e.g. so we know !voice corresponds to chanops.py"""
aliases = {
"voice": "chanops",
"devoice": "chanops",
"op": "chanops",
"deop": "chanops",
}
return aliases[key]

def call(c, d):
global connection, data
connection, data = c, d
@@ -26,10 +34,11 @@ def do_command_help():
exec "from irc.commands import %s as this_command" % command
except ImportError: # if we can't find it directly, this could be an alias for another command
try:
this_command = triggers.get_alias(command)
cmd = get_alias(command)
except KeyError:
connection.reply(data.chan, data.nick, "command \x0303%s\x0301 not found!" % command)
return
exec "from irc.commands import %s as this_command" % cmd

info = this_command.__doc__



+ 0
- 10
irc/triggers.py 查看文件

@@ -4,16 +4,6 @@

from irc.commands import test, help, git, link, chanops

def get_alias(key):
"""used by help.py, e.g. so we know !voice corresponds to chanops.py"""
aliases = {
"voice": chanops,
"devoice": chanops,
"op": chanops,
"deop": chanops,
}
return aliases[key]

def check(connection, data, hook):
data.parse_args() # parse command arguments into data.command and data.args



Loading…
取消
儲存