@@ -98,33 +98,20 @@ def __new__(cls, *args, **kwargs) -> Self:
9898 rate = getattr (self , "cooldown_rate" , 10 )
9999 per = getattr (self , "cooldown_per" , 3 )
100100 key = getattr (self , "cooldown_key" , BucketType .user )
101- bucket_ : Bucket [Context ] = Bucket .from_cooldown (base = Cooldown , key = key , ** {"per" : per , "rate" : rate })
101+ bucket_ : Bucket [Context ] = Bucket .from_cooldown (base = Cooldown , key = key , ** {"per" : per , "rate" : rate }) # NOQA
102102 category_name : str = getattr (self , "name" , self .__class__ .__name__ )
103103 category_name = category_name .removesuffix ("Cmd" ).removesuffix ("Cmds" )
104104 self .inject_events (bot , cls , self , category_name )
105105 for command_name in self .__all_commands__ :
106106 command_ : Command = self .__all_commands__ [command_name ]
107107 if hasattr (command_ , "commands" ):
108108 for name in command_ .commands :
109- self . _extras (command_ .commands [name ], bucket_ , bot )
110- bot . docs [ category_name ][ command_ . commands [ name ]. name ] = command_ .commands [name ].docs
111- self . _extras (command_ , bucket_ , bot )
112- bot . docs [ category_name ][ command_ . name ] = command_ .docs
109+ if len (command_ .commands [name ]. _buckets ) == 0 : # NOQA
110+ command_ .commands [name ]._buckets . append ( bucket_ ) # NOQA
111+ if len (command_ . _buckets ) == 0 : # NOQA
112+ command_ ._buckets . append ( bucket_ ) # NOQA
113113 return self
114114
115- @staticmethod
116- def _extras (new_command : Command , bucket_ , bot : Gorenmu ):
117- if len (new_command ._buckets ) == 0 : # NOQA
118- new_command ._buckets .append (bucket_ ) # NOQA
119-
120- def docs ():
121- if new_command .template :
122- return bot .docs_handler .template_description (new_command )
123- else :
124- return bot .docs_handler .normal_description (new_command )
125-
126- new_command .docs = docs
127-
128115 @staticmethod
129116 def inject_events (bot , cls , self , category_name ):
130117 if category_name in bot .manual_events :
@@ -137,15 +124,6 @@ def inject_events(bot, cls, self, category_name):
137124 bot .manual_events [category_name ][event_name ][name ] = injected
138125
139126
140- def base_decorator (base : str , template = False ) -> Callable [[Command ], Command ]:
141- def decorator (command : Command ) -> Command : # NOQA
142- command .decorator_path = base
143- command .template = template
144- return command
145-
146- return decorator
147-
148-
149127def command (
150128 name : str | None = None ,
151129 aliases : list [str ] | None = None ,
@@ -239,12 +217,3 @@ def decorator(func: Callable):
239217 return func
240218
241219 return decorator
242-
243-
244- # def event_handler(event_name: str):
245- # def decorator(func: Callable):
246- # async def wrapper(self, *args, **kwargs):
247- # return await func(self, *args, **kwargs)
248- # wrapper._event_info = event_name
249- # return wrapper
250- # return decorator
0 commit comments