Fix `@loader.inline_handler` processing

pull/1/head
hikariatama 2022-08-03 20:04:43 +00:00
parent 1fd2966ca6
commit fed8d35a0d
1 changed files with 4 additions and 4 deletions

View File

@ -350,7 +350,7 @@ def translatable_docstring(cls):
@wraps(cls.config_complete) @wraps(cls.config_complete)
def config_complete(self, *args, **kwargs): def config_complete(self, *args, **kwargs):
def proccess_decorators(mark: str): def proccess_decorators(mark: str, obj: str):
nonlocal self nonlocal self
for attr in dir(func_): for attr in dir(func_):
if ( if (
@ -363,18 +363,18 @@ def translatable_docstring(cls):
setattr(self, var, {}) setattr(self, var, {})
getattr(self, var).setdefault( getattr(self, var).setdefault(
f"{mark}{command_}", getattr(func_, attr) f"{mark}{obj}", getattr(func_, attr)
) )
for command_, func_ in get_commands(cls).items(): for command_, func_ in get_commands(cls).items():
proccess_decorators("_cmd_doc_") proccess_decorators("_cmd_doc_", command_)
try: try:
func_.__doc__ = self.strings[f"_cmd_doc_{command_}"] func_.__doc__ = self.strings[f"_cmd_doc_{command_}"]
except AttributeError: except AttributeError:
func_.__func__.__doc__ = self.strings[f"_cmd_doc_{command_}"] func_.__func__.__doc__ = self.strings[f"_cmd_doc_{command_}"]
for inline_handler_, func_ in get_inline_handlers(cls).items(): for inline_handler_, func_ in get_inline_handlers(cls).items():
proccess_decorators("_ihandle_doc_") proccess_decorators("_ihandle_doc_", inline_handler_)
try: try:
func_.__doc__ = self.strings[f"_ihandle_doc_{inline_handler_}"] func_.__doc__ = self.strings[f"_ihandle_doc_{inline_handler_}"]
except AttributeError: except AttributeError: