init
This commit is contained in:
36
game_server/handlers/SendMsgCsReq.py
Normal file
36
game_server/handlers/SendMsgCsReq.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import betterproto
|
||||
from game_server.net.session import PlayerSession
|
||||
from game_server.game.chat.command_handler import handler
|
||||
from rail_proto.lib import (
|
||||
SendMsgCsReq,
|
||||
SendMsgScRsp,
|
||||
RevcMsgScNotify,
|
||||
MsgType,
|
||||
ChatType
|
||||
)
|
||||
|
||||
async def handle(session: PlayerSession, msg: SendMsgCsReq) -> betterproto.Message:
|
||||
if msg.message_type == MsgType.MSG_TYPE_CUSTOM_TEXT:
|
||||
session.pending_notify(
|
||||
RevcMsgScNotify(
|
||||
message_type=MsgType.MSG_TYPE_CUSTOM_TEXT.value,
|
||||
chat_type=ChatType.CHAT_TYPE_PRIVATE.value,
|
||||
message_text=msg.message_text,
|
||||
target_uid=69,
|
||||
source_uid=session.player.data.uid
|
||||
)
|
||||
)
|
||||
text = await handler.handle_command(session, msg.message_text)
|
||||
if text:
|
||||
session.pending_notify(
|
||||
RevcMsgScNotify(
|
||||
message_type=MsgType.MSG_TYPE_CUSTOM_TEXT.value,
|
||||
chat_type=ChatType.CHAT_TYPE_PRIVATE.value,
|
||||
message_text=text,
|
||||
target_uid=session.player.data.uid,
|
||||
source_uid=69
|
||||
)
|
||||
)
|
||||
return SendMsgScRsp(
|
||||
retcode=0
|
||||
)
|
||||
Reference in New Issue
Block a user