mirror of
https://github.com/solero/houdini.git
synced 2025-10-17 21:08:17 +00:00
Message handlers implemented, await used in the send_xt method.
This commit is contained in:
19
houdini/handlers/play/message.py
Normal file
19
houdini/handlers/play/message.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from houdini import handlers
|
||||
from houdini.handlers import XTPacket
|
||||
from houdini.commands import invoke_command_string
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('m', 'sm'))
|
||||
@handlers.cooldown(.5)
|
||||
async def handle_send_message(p, penguin_id: int, message):
|
||||
if penguin_id != p.data.id:
|
||||
return await p.close()
|
||||
|
||||
if p.muted:
|
||||
for room_player in p.room.penguins:
|
||||
if room_player.data.moderator:
|
||||
await room_player.sendXt("mm", message, penguin_id)
|
||||
return
|
||||
|
||||
await p.room.send_xt('sm', p.data.id, message)
|
||||
await invoke_command_string(p.server.commands, p, message)
|
Reference in New Issue
Block a user