Skip to content

Commit

Permalink
Hot fix cl_unit kwargs (#13)
Browse files Browse the repository at this point in the history
- Исправлен небольшой косяк при передаче параметров для _call_func в
клиенте и сервере
  • Loading branch information
themanyfaceddemon authored Sep 12, 2024
1 parent 2976f51 commit e41b4e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DMBotNetwork/main/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ async def _call_func(

try:
if inspect.iscoroutinefunction(func):
return await func(**valid_kwargs)
return await func(cl_unit=cl_unit, **valid_kwargs)

else:
return func(**valid_kwargs)
return func(cl_unit=cl_unit, **valid_kwargs)

except Exception as e:
logger.error(f"Error calling method '{func_name}' in {cls.__name__}: {e}")
Expand Down
5 changes: 3 additions & 2 deletions server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@


class NetClassPong:
async def net_ping(self, cl_unit: ClUnit) -> None:
@staticmethod
async def net_ping(cl_unit: ClUnit) -> None:
await cl_unit.send_log_info(f"Pong, {cl_unit.login}!")


Expand All @@ -19,7 +20,7 @@ async def main():
base_access={},
allow_registration=False,
timeout=5.0,
max_player=0,
max_player=5,
)

Server.register_methods_from_class(NetClassPong)
Expand Down

0 comments on commit e41b4e8

Please sign in to comment.