上传文件至 /

Signed-off-by: SharwOrange橙夜 <kuliangcha@qq.com>
This commit is contained in:
SharwOrange橙夜 2023-12-26 10:42:25 +00:00
parent 07d297173d
commit 4d38da674e
2 changed files with 8 additions and 1 deletions

View File

@ -10,7 +10,7 @@ import socketio
from colorama import Fore, Style from colorama import Fore, Style
from nacl.signing import SigningKey from nacl.signing import SigningKey
from lib_not_dr.types import Options from lib_not_dr.types import Options
from mcstatus import JavaServer
def get_config() -> Tuple[str, str, int]: def get_config() -> Tuple[str, str, int]:
with open('config.toml', 'r', encoding='utf-8') as f: with open('config.toml', 'r', encoding='utf-8') as f:
@ -192,6 +192,12 @@ async def add_message(data: Dict[str, Any]):
message = Message(content='icalingua bot test', message = Message(content='icalingua bot test',
room_id=data['roomId']) room_id=data['roomId'])
await sio.emit('sendMessage', message.to_json()) await sio.emit('sendMessage', message.to_json())
if content == '!!status':
server = JavaServer.lookup("server1.xfcloud.org")
status=server.status()
message = Message(content=f"此服务器有 {status.players.online} 个玩家在线",
room_id=data['roomId'])
await sio.emit('sendMessage', message.to_json())
elif data.get('message').get('content').startswith('=='): elif data.get('message').get('content').startswith('=='):
evals: str = data.get('message').get('content')[2:] evals: str = data.get('message').get('content')[2:]

View File

@ -3,3 +3,4 @@ colorama
rtoml rtoml
pynacl pynacl
python-socketio[asyncio_client] python-socketio[asyncio_client]
mcstatus