@@ -24,6 +24,12 @@ def is_git_directory(self, path="."):
24
24
25
25
return tags .pop (- 1 ) if tags is not None else None
26
26
27
+ def may_access_command (self , m , cmd ):
28
+ m , _ , _ = self ._bot ._process_command_filters (
29
+ msg = m , cmd = cmd , args = None , dry_run = True
30
+ )
31
+ return m is not None
32
+
27
33
# noinspection PyUnusedLocal
28
34
@botcmd (template = "about" )
29
35
def about (self , msg , args ):
@@ -52,7 +58,7 @@ def apropos(self, msg, args):
52
58
commands = cls_commands .get (cls , [])
53
59
if (
54
60
not self .bot_config .HIDE_RESTRICTED_COMMANDS
55
- or self ._bot . check_command_access (msg , name )[ 0 ]
61
+ or self .may_access_command (msg , name )
56
62
):
57
63
commands .append ((name , command ))
58
64
cls_commands [cls ] = commands
@@ -86,15 +92,6 @@ def help(self, msg, args):
86
92
"""Returns a help string listing available options.
87
93
Automatically assigned to the "help" command."""
88
94
89
- def may_access_command (m , cmd ):
90
- m , _ , _ = self ._bot ._process_command_filters (
91
- msg = m , cmd = cmd , args = None , dry_run = True
92
- )
93
- return m is not None
94
-
95
- def get_name (named ):
96
- return named .__name__ .lower ()
97
-
98
95
# Normalize args to lowercase for ease of use
99
96
args = args .lower () if args else ""
100
97
usage = ""
@@ -105,8 +102,9 @@ def get_name(named):
105
102
cls = self ._bot .get_plugin_class_from_method (command )
106
103
obj = command .__self__
107
104
_ , commands = cls_obj_commands .get (cls , (None , []))
108
- if not self .bot_config .HIDE_RESTRICTED_COMMANDS or may_access_command (
109
- msg , name
105
+ if (
106
+ not self .bot_config .HIDE_RESTRICTED_COMMANDS
107
+ or self .may_access_command (msg , name )
110
108
):
111
109
commands .append ((name , command ))
112
110
cls_obj_commands [cls ] = (obj , commands )
@@ -163,7 +161,7 @@ def get_name(named):
163
161
if command ._err_command_hidden :
164
162
continue
165
163
166
- if not may_access_command (msg , name ):
164
+ if not self . may_access_command (msg , name ):
167
165
continue
168
166
pairs .append ((name , command ))
169
167
0 commit comments