Skip to content

Commit

Permalink
Merge pull request #1967 from sopel-irc/plugin-plural-aliases
Browse files Browse the repository at this point in the history
plugin: keep old-school plugin devs happy w/plural command decorators
  • Loading branch information
dgw authored Dec 14, 2020
2 parents e996b87 + 3d7ec8f commit 3a27545
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sopel/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
# Therefore, don't add anything to this import list. Ever.
from sopel.plugin import ( # noqa
ADMIN,
action_command as action_commands,
command as commands,
action_commands,
commands,
echo,
event,
example,
HALFOP,
intent,
interval,
nickname_command as nickname_commands,
nickname_commands,
NOLIMIT,
OP,
OPER,
Expand Down
15 changes: 15 additions & 0 deletions sopel/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'NOLIMIT', 'VOICE', 'HALFOP', 'OP', 'ADMIN', 'OWNER', 'OPER',
# decorators
'action_command',
'action_commands',
'command',
'commands',
'echo',
'event',
'example',
Expand All @@ -27,6 +29,7 @@
'interval',
'label',
'nickname_command',
'nickname_commands',
'output_prefix',
'priority',
'rate',
Expand Down Expand Up @@ -455,6 +458,10 @@ def add_attribute(function):
return add_attribute


commands = command
"""Alias to :func:`command`."""


def nickname_command(*command_list):
"""Decorate a function to trigger on lines starting with "$nickname: command".
Expand Down Expand Up @@ -501,6 +508,10 @@ def add_attribute(function):
return add_attribute


nickname_commands = nickname_command
"""Alias to :func:`nickname_command`."""


def action_command(*command_list):
"""Decorate a function to trigger on CTCP ACTION lines.
Expand Down Expand Up @@ -546,6 +557,10 @@ def add_attribute(function):
return add_attribute


action_commands = action_command
"""Alias to :func:`action_command`."""


def label(value):
"""Decorate a function to add a rule label.
Expand Down

0 comments on commit 3a27545

Please sign in to comment.