mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-18 22:11:07 +00:00
fix /command help message
This commit is contained in:
parent
23094fd152
commit
f2889dd674
3 changed files with 12 additions and 10 deletions
|
|
@ -11,11 +11,7 @@ module.exports.player=function(player,serv)
|
|||
{
|
||||
player._client.on('chat', ({message} = {}) => {
|
||||
if(message[0]=="/") {
|
||||
player.behavior('command', {
|
||||
command: message.slice(1)
|
||||
}, ({command}) => {
|
||||
player.handleCommand(command);
|
||||
});
|
||||
player.behavior('command', {command: message.slice(1)}, ({command}) => player.handleCommand(command));
|
||||
}
|
||||
else {
|
||||
player.behavior('chat', {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,13 @@ module.exports.player=function(player) {
|
|||
});
|
||||
|
||||
|
||||
player.handleCommand = (str) => {
|
||||
player.commands.use(str).catch((err)=> setTimeout(() => {throw err;},0));
|
||||
};
|
||||
player.handleCommand = async (str) => {
|
||||
try {
|
||||
var res = await player.commands.use(str)
|
||||
if (res) player.chat('' + res);
|
||||
}
|
||||
catch(err) {
|
||||
setTimeout(() => {throw err;}, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ module.exports.player=function(player,serv){
|
|||
info: 'to change a time to night',
|
||||
usage: '/night',
|
||||
action(params) {
|
||||
player.handleCommand('time set night');
|
||||
return player.handleCommand('time set night');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ module.exports.player=function(player,serv){
|
|||
info: 'to change a time to day',
|
||||
usage: '/day',
|
||||
action(params) {
|
||||
player.handleCommand('time set day');
|
||||
return player.handleCommand('time set day');
|
||||
}
|
||||
});
|
||||
};
|
||||
Loading…
Reference in a new issue