merge develop

This commit is contained in:
Matthew Hodgson 2016-01-17 23:31:21 +00:00
commit f3aeda7af9
9 changed files with 219 additions and 47 deletions

View file

@ -69,7 +69,7 @@ var commands = {
}),
// Changes the colorscheme of your current room
tint: new Command("tint", "<primaryColor> [<secondaryColor>]", function(room_id, args) {
tint: new Command("tint", "<color1> [<color2>]", function(room_id, args) {
if (args) {
var matches = args.match(/^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}))( +(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})))?$/);
if (matches) {
@ -89,7 +89,7 @@ var commands = {
return reject(this.getUsage());
}),
encrypt: new Command("encrypt", "<on/off>", function(room_id, args) {
encrypt: new Command("encrypt", "<on|off>", function(room_id, args) {
if (args == "on") {
var client = MatrixClientPeg.get();
var members = client.getRoom(room_id).currentState.members;
@ -316,7 +316,9 @@ var commands = {
};
// helpful aliases
commands.j = commands.join;
var aliases = {
j: "join"
}
module.exports = {
/**
@ -336,6 +338,9 @@ module.exports = {
var cmd = bits[1].substring(1).toLowerCase();
var args = bits[3];
if (cmd === "me") return null;
if (aliases[cmd]) {
cmd = aliases[cmd];
}
if (commands[cmd]) {
return commands[cmd].run(roomId, args);
}
@ -347,8 +352,12 @@ module.exports = {
},
getCommandList: function() {
return Object.keys(commands).map(function(cmdKey) {
// Return all the commands plus /me which isn't handled like normal commands
var cmds = Object.keys(commands).sort().map(function(cmdKey) {
return commands[cmdKey];
});
})
cmds.push(new Command("me", "<action>", function(){}));
return cmds;
}
};