mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 11:40:46 +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} = {}) => {
|
player._client.on('chat', ({message} = {}) => {
|
||||||
if(message[0]=="/") {
|
if(message[0]=="/") {
|
||||||
player.behavior('command', {
|
player.behavior('command', {command: message.slice(1)}, ({command}) => player.handleCommand(command));
|
||||||
command: message.slice(1)
|
|
||||||
}, ({command}) => {
|
|
||||||
player.handleCommand(command);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
player.behavior('chat', {
|
player.behavior('chat', {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,13 @@ module.exports.player=function(player) {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
player.handleCommand = (str) => {
|
player.handleCommand = async (str) => {
|
||||||
player.commands.use(str).catch((err)=> setTimeout(() => {throw err;},0));
|
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',
|
info: 'to change a time to night',
|
||||||
usage: '/night',
|
usage: '/night',
|
||||||
action(params) {
|
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',
|
info: 'to change a time to day',
|
||||||
usage: '/day',
|
usage: '/day',
|
||||||
action(params) {
|
action(params) {
|
||||||
player.handleCommand('time set day');
|
return player.handleCommand('time set day');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Loading…
Reference in a new issue