Skip to content

Commit

Permalink
API: change sender to send_matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooling0602 committed Nov 8, 2024
1 parent b5bc903 commit 8dcee58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions matrix_sync/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from matrix_sync.client import init
from matrix_sync.config import load_config, check_config
from matrix_sync.utils.commands import *
from matrix_sync.reporter import sender
from matrix_sync.reporter import send_matrix
from mcdreforged.api.all import *

# Framwork ver: 2.4.0-3
Expand All @@ -35,7 +35,7 @@ def on_server_startup(server: PluginServerInterface):
if not tLock.locked():
if clientStatus:
message = psi.rtr("matrix_sync.sync_tips.server_started")
sender(message)
send_matrix(message)
start_room_msg()
else:
server.logger.info(server.rtr("matrix_sync.manual_sync.start_error"))
Expand All @@ -47,7 +47,7 @@ def on_user_info(server: PluginServerInterface, info: Info):
playerMsg = f"<{info.player}> {info.content}"
clientStatus = matrix_sync.client.clientStatus
if clientStatus:
sender(playerMsg)
send_matrix(playerMsg)

# Exit sync process when server stop.
def on_server_stop(server: PluginServerInterface, server_return_code: int):
Expand All @@ -57,13 +57,13 @@ def on_server_stop(server: PluginServerInterface, server_return_code: int):
clientStatus = matrix_sync.client.clientStatus
stopTip = server.rtr("matrix_sync.sync_tips.server_stopped")
if clientStatus:
sender(stopTip)
send_matrix(stopTip)
else:
server.logger.info(server.rtr("matrix_sync.on_server_crash"))
crashTip = server.rtr("matrix_sync.sync_tips.server_crashed")
clientStatus = matrix_sync.client.clientStatus
if clientStatus:
sender(crashTip)
send_matrix(crashTip)

if sync_task is not None:
sync_task.cancel()
Expand Down
2 changes: 1 addition & 1 deletion matrix_sync/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Game Message reporter.
@new_thread('MatrixReporter')
def sender(message):
def send_matrix(message):
asyncio.run(send(message))

async def send(message):
Expand Down

0 comments on commit 8dcee58

Please sign in to comment.