mirror of
https://github.com/solero/houdini.git
synced 2024-11-25 06:57:24 +00:00
Catch UnknownCommandException
and forward unknown command messages
This commit is contained in:
parent
d862af504d
commit
afe0457714
@ -1,5 +1,5 @@
|
|||||||
from houdini import handlers
|
from houdini import handlers
|
||||||
from houdini.commands import has_command_prefix, invoke_command_string
|
from houdini.commands import has_command_prefix, invoke_command_string, UnknownCommandException
|
||||||
from houdini.data.moderator import ChatFilterRuleCollection
|
from houdini.data.moderator import ChatFilterRuleCollection
|
||||||
from houdini.handlers import XTPacket
|
from houdini.handlers import XTPacket
|
||||||
from houdini.handlers.play.moderation import moderator_ban
|
from houdini.handlers.play.moderation import moderator_ban
|
||||||
@ -35,6 +35,7 @@ async def handle_send_message(p, penguin_id: int, message: str):
|
|||||||
if consequence.filter:
|
if consequence.filter:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
if has_command_prefix(p.server.config.command_prefix, message):
|
if has_command_prefix(p.server.config.command_prefix, message):
|
||||||
await p.room.send_xt('mm', message, p.id, f=lambda px: px.moderator)
|
await p.room.send_xt('mm', message, p.id, f=lambda px: px.moderator)
|
||||||
await invoke_command_string(p.server.commands, p, message)
|
await invoke_command_string(p.server.commands, p, message)
|
||||||
@ -42,3 +43,6 @@ async def handle_send_message(p, penguin_id: int, message: str):
|
|||||||
await p.room.send_xt('sm', p.id, message)
|
await p.room.send_xt('sm', p.id, message)
|
||||||
|
|
||||||
p.logger.info(f'{p.username} said \'{message}\' in room \'{p.room.name}\'')
|
p.logger.info(f'{p.username} said \'{message}\' in room \'{p.room.name}\'')
|
||||||
|
except UnknownCommandException:
|
||||||
|
await p.room.send_xt('sm', p.id, message)
|
||||||
|
p.logger.warn(f'{p.username} tried to use a command that does not exist \'{message}\'')
|
||||||
|
Loading…
Reference in New Issue
Block a user