@@ -24,6 +24,12 @@ def is_git_directory(self, path="."):
2424
2525 return tags .pop (- 1 ) if tags is not None else None
2626
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+
2733 # noinspection PyUnusedLocal
2834 @botcmd (template = "about" )
2935 def about (self , msg , args ):
@@ -52,7 +58,7 @@ def apropos(self, msg, args):
5258 commands = cls_commands .get (cls , [])
5359 if (
5460 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 )
5662 ):
5763 commands .append ((name , command ))
5864 cls_commands [cls ] = commands
@@ -86,15 +92,6 @@ def help(self, msg, args):
8692 """Returns a help string listing available options.
8793 Automatically assigned to the "help" command."""
8894
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-
9895 # Normalize args to lowercase for ease of use
9996 args = args .lower () if args else ""
10097 usage = ""
@@ -105,8 +102,9 @@ def get_name(named):
105102 cls = self ._bot .get_plugin_class_from_method (command )
106103 obj = command .__self__
107104 _ , 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 )
110108 ):
111109 commands .append ((name , command ))
112110 cls_obj_commands [cls ] = (obj , commands )
@@ -163,7 +161,7 @@ def get_name(named):
163161 if command ._err_command_hidden :
164162 continue
165163
166- if not may_access_command (msg , name ):
164+ if not self . may_access_command (msg , name ):
167165 continue
168166 pairs .append ((name , command ))
169167
0 commit comments