Add /help, make /part take an optional channel param
This commit is contained in:
parent
ccb0149b3d
commit
b83efcbb9e
@ -1,3 +1,5 @@
|
||||
var _ = require('lodash');
|
||||
|
||||
var channelStore = require('./stores/channel');
|
||||
var channelActions = require('./actions/channel');
|
||||
var messageActions = require('./actions/message');
|
||||
@ -27,7 +29,9 @@ messageActions.command.listen(function(line, channel, server) {
|
||||
break;
|
||||
|
||||
case 'part':
|
||||
if (channel) {
|
||||
if (params[1]) {
|
||||
channelActions.part([params[1]], server);
|
||||
} else if (channel) {
|
||||
channelActions.part([channel], server);
|
||||
}
|
||||
break;
|
||||
@ -88,5 +92,19 @@ messageActions.command.listen(function(line, channel, server) {
|
||||
case 'away':
|
||||
serverActions.away(params[1], server);
|
||||
break;
|
||||
|
||||
case 'help':
|
||||
messageActions.inform([
|
||||
_.escape('/join <channel> - Join a channel'),
|
||||
'/part [channel] - Leave the current or entered channel',
|
||||
_.escape('/nick <nick> - Change nick'),
|
||||
'/quit - Disconnect from the current server',
|
||||
_.escape('/me <message> - Send action message'),
|
||||
'/topic - Show topic for the current channel',
|
||||
_.escape('/msg <target> <message> - Send message to the entered channel or user'),
|
||||
_.escape('/say <message> - Send message to the current chat'),
|
||||
'/away [message] - Set or clear away message'
|
||||
], server, channel);
|
||||
break;
|
||||
}
|
||||
});
|
@ -59,12 +59,14 @@ socket.on('mode', function(data) {
|
||||
socket.on('whois', function(data) {
|
||||
var tab = selectedTabStore.getState();
|
||||
|
||||
messageActions.inform('Nick: ' + data.nick, tab.server, tab.channel);
|
||||
messageActions.inform('Username: ' + data.username, tab.server, tab.channel);
|
||||
messageActions.inform('Realname: ' + data.realname, tab.server, tab.channel);
|
||||
messageActions.inform('Host: ' + data.host, tab.server, tab.channel);
|
||||
messageActions.inform('Server: ' + data.server, tab.server, tab.channel);
|
||||
messageActions.inform('Channels: ' + data.channels, tab.server, tab.channel);
|
||||
messageActions.inform([
|
||||
'Nick: ' + data.nick,
|
||||
'Username: ' + data.username,
|
||||
'Realname: ' + data.realname,
|
||||
'Host: ' + data.host,
|
||||
'Server: ' + data.server,
|
||||
'Channels: ' + data.channels
|
||||
], tab.server, tab.channel);
|
||||
});
|
||||
|
||||
socket.on('servers', function(data) {
|
||||
|
@ -72,12 +72,24 @@ var messageStore = Reflux.createStore({
|
||||
},
|
||||
|
||||
inform: function(message, server, channel) {
|
||||
if (_.isArray(message)) {
|
||||
_.each(message, (msg) => {
|
||||
addMessage({
|
||||
server: server,
|
||||
to: channel,
|
||||
message: msg,
|
||||
type: 'info'
|
||||
}, channel || server);
|
||||
});
|
||||
} else {
|
||||
addMessage({
|
||||
server: server,
|
||||
to: channel,
|
||||
message: message,
|
||||
type: 'info'
|
||||
}, channel || server);
|
||||
}
|
||||
|
||||
this.trigger(messages);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user