mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 10:32:19 +08:00
feat: python 接口适配 AsstRunning 接口
This commit is contained in:
@@ -112,10 +112,16 @@ class Asst:
|
||||
|
||||
:return: 是否成功
|
||||
"""
|
||||
Asst.__lib.AsstStop.restype = ctypes.c_bool
|
||||
Asst.__lib.AsstStop.argtypes = (ctypes.c_void_p,)
|
||||
return Asst.__lib.AsstStop(self.__ptr)
|
||||
|
||||
def running(self) -> bool:
|
||||
"""
|
||||
是否正在运行
|
||||
|
||||
:return: 是否正在运行
|
||||
"""
|
||||
return Asst.__lib.AsstRunning(self.__ptr)
|
||||
|
||||
@staticmethod
|
||||
def log(level: str, message: str) -> None:
|
||||
'''
|
||||
@@ -132,7 +138,7 @@ class Asst:
|
||||
"""
|
||||
获取DLL版本号
|
||||
|
||||
:return: 版本号
|
||||
: return: 版本号
|
||||
"""
|
||||
return Asst.__lib.AsstGetVersion().decode('utf-8')
|
||||
|
||||
@@ -166,6 +172,12 @@ class Asst:
|
||||
Asst.__lib.AsstStart.restype = ctypes.c_bool
|
||||
Asst.__lib.AsstStart.argtypes = (ctypes.c_void_p,)
|
||||
|
||||
Asst.__lib.AsstStop.restype = ctypes.c_bool
|
||||
Asst.__lib.AsstStop.argtypes = (ctypes.c_void_p,)
|
||||
|
||||
Asst.__lib.AsstRunning.restype = ctypes.c_bool
|
||||
Asst.__lib.AsstRunning.argtypes = (ctypes.c_void_p,)
|
||||
|
||||
Asst.__lib.AsstGetVersion.restype = ctypes.c_char_p
|
||||
|
||||
Asst.__lib.AsstLog.restype = None
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
import pathlib
|
||||
import asyncio
|
||||
|
||||
from asst import Asst, Message
|
||||
|
||||
@@ -64,5 +65,5 @@ if __name__ == "__main__":
|
||||
|
||||
asst.start()
|
||||
|
||||
while True:
|
||||
input('>')
|
||||
while asst.running():
|
||||
asyncio.sleep(0)
|
||||
|
||||
Reference in New Issue
Block a user