Inform about commands not found

This commit is contained in:
Ken-Håvard Lieng 2017-05-22 03:49:37 +02:00
parent 7e080f2c99
commit 41d6099d89
9 changed files with 68 additions and 55 deletions

View file

@ -3,7 +3,7 @@ import { COMMAND } from './actions';
import { setNick, disconnect, whois, away } from './actions/server';
import { join, part, invite, kick } from './actions/channel';
import { select } from './actions/tab';
import { sendMessage, addMessage, inform, raw } from './actions/message';
import { sendMessage, addMessage, raw } from './actions/message';
const help = [
'/join <channel> - Join a channel',
@ -62,7 +62,7 @@ export default createCommandMiddleware(COMMAND, {
content: topic
}));
} else {
dispatch(inform('No topic set', server, channel));
return 'No topic set';
}
},
@ -104,11 +104,17 @@ export default createCommandMiddleware(COMMAND, {
raw({ dispatch, server }, ...message) {
if (message) {
dispatch(raw(message.join(' '), server));
const cmd = message.join(' ');
dispatch(raw(cmd, server));
return `=> ${cmd}`;
}
},
help({ dispatch, server, channel }) {
dispatch(inform(help, server, channel));
help() {
return help;
},
commandNotFound(_, command) {
return `The command /${command} was not found`;
}
});