mirror of
https://github.com/solero/houdini.git
synced 2024-12-23 14:03:38 +00:00
Message handlers implemented, await used in the send_xt method.
This commit is contained in:
parent
a7932dd837
commit
25cb12df08
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)
|
@ -5,7 +5,7 @@ from houdini.spheniscidae import Spheniscidae
|
|||||||
|
|
||||||
class Penguin(Spheniscidae):
|
class Penguin(Spheniscidae):
|
||||||
|
|
||||||
__slots__ = ['x', 'y', 'frame', 'room', 'waddle', 'table', 'data',
|
__slots__ = ['x', 'y', 'frame', 'room', 'waddle', 'table', 'data', 'muted'
|
||||||
'login_key', 'member', 'membership_days', 'avatar',
|
'login_key', 'member', 'membership_days', 'avatar',
|
||||||
'walking_puffle', 'permissions', 'active_quests']
|
'walking_puffle', 'permissions', 'active_quests']
|
||||||
|
|
||||||
@ -17,6 +17,7 @@ class Penguin(Spheniscidae):
|
|||||||
self.room = None
|
self.room = None
|
||||||
self.waddle = None
|
self.waddle = None
|
||||||
self.table = None
|
self.table = None
|
||||||
|
self.muted = False
|
||||||
|
|
||||||
self.data = None
|
self.data = None
|
||||||
self.login_key = None
|
self.login_key = None
|
||||||
|
@ -30,4 +30,4 @@ class Example(IPlugin):
|
|||||||
@commands.command('ping')
|
@commands.command('ping')
|
||||||
@permissions.has('houdini.ping')
|
@permissions.has('houdini.ping')
|
||||||
async def ping(self, p):
|
async def ping(self, p):
|
||||||
p.send_xt('cprompt', 'Pong')
|
await p.send_xt('cprompt', 'Pong')
|
||||||
|
Loading…
Reference in New Issue
Block a user