Skip to content

Commit 3c6eb6f

Browse files
committed
update ignore.py to use command spec (and not docstrings)
1 parent 39db6de commit 3c6eb6f

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/core_modules/ignore.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,19 @@ def _timer_unignore(self, event):
7171
self.bot.database.user_settings.delete(
7272
event["user_id"], event["setting"])
7373

74-
@utils.hook("received.command.unignore", min_args=1)
74+
@utils.hook("received.command.unignore")
75+
@utils.kwarg("help", "Unignore commands from a given user")
76+
@utils.kwarg("permission", "unignore")
77+
@utils.spec("!<nickname>ouser ?<command>wordlower")
7578
def unignore(self, event):
76-
"""
77-
:help: Unignore commands from a given user
78-
:usage: <nickname> [command]
79-
:permission: unignore
80-
"""
8179
setting = "ignore"
8280
for_str = ""
83-
if len(event["args_split"]) > 1:
84-
command = event["args_split"][1].lower()
81+
if event["spec"][1]:
82+
command = event["spec"][1]
8583
setting = "ignore-%s" % command
8684
for_str = " for '%s'" % command
8785

88-
user = event["server"].get_user(event["args_split"][0])
86+
user = event["spec"][0]
8987
if not user.get_setting(setting, False):
9088
event["stderr"].write("I'm not ignoring '%s'%s" %
9189
(user.nickname, for_str))
@@ -125,12 +123,12 @@ def cignore(self, event):
125123
True)
126124
event["stdout"].write("Ignoring %s" % target_user.nickname)
127125

128-
@utils.hook("received.command.serverignore", min_args=1)
126+
@utils.hook("received.command.serverignore")
127+
@utils.kwarg("help", "Ignore a command on the current server")
128+
@utils.kwarg("permissions", "serverignore")
129+
@utils.spec("!<command>wordlower")
129130
def server_ignore(self, event):
130-
"""
131-
:permission: server-ignore
132-
"""
133-
command = event["args_split"][0].lower()
131+
command = event["spec"][0]
134132
setting = "ignore-%s" % command
135133

136134
if event["server"].get_setting(setting, False):
@@ -141,12 +139,12 @@ def server_ignore(self, event):
141139
event["stdout"].write("Now ignoring '%s' for %s" %
142140
(command, str(event["server"])))
143141

144-
@utils.hook("received.command.serverunignore", min_args=1)
142+
@utils.hook("received.command.serverunignore")
143+
@utils.kwarg("help", "Unignore a command on the current server")
144+
@utils.kwarg("permissions", "serverunignore")
145+
@utils.spec("!<command>wordlower")
145146
def server_unignore(self, event):
146-
"""
147-
:permission: server-unignore
148-
"""
149-
command = event["args_split"][0].lower()
147+
command = event["spec"][0]
150148
setting = "ignore-%s" % command
151149

152150
if not event["server"].get_setting(setting, False):

0 commit comments

Comments
 (0)