mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-19 14:31:17 +00:00
19 lines
No EOL
514 B
JavaScript
19 lines
No EOL
514 B
JavaScript
module.exports=inject;
|
|
|
|
function inject(serv, player, options)
|
|
{
|
|
player._client.on('chat', function (data) {
|
|
if(data.message[0]=="/" && options.commands[data.message.slice(1)]) {
|
|
player.chat("" + options.commands[data.message.slice(1)]);
|
|
} else {
|
|
serv.broadcast('<' + player.username + '>' + ' ' + data.message);
|
|
player.emit("chat",data.message);
|
|
}
|
|
});
|
|
|
|
function chat(message) {
|
|
player._client.write('chat', { message: JSON.stringify(message), position: 0 });
|
|
}
|
|
|
|
player.chat=chat;
|
|
} |