Added '/ame' and '/amsg' command

This commit is contained in:
Mattias Erming 2014-05-18 18:18:19 +02:00
parent 8fe6110a93
commit f731707fe7
3 changed files with 37 additions and 2 deletions

View File

@ -3,8 +3,8 @@ Run your IRC client on a server and access it from the web browser. This gives y
### Commands ### Commands
These are the commands currently implemented: These are the commands currently implemented:
- [ ] /ame - [x] /ame
- [ ] /amsg - [x] /amsg
- [x] /close - [x] /close
- [x] /connect - [x] /connect
- [x] /deop - [x] /deop
@ -29,6 +29,7 @@ These are the commands currently implemented:
- [x] /say - [x] /say
- [x] /send - [x] /send
- [x] /server - [x] /server
- [ ] /slap
- [ ] /time - [ ] /time
- [x] /topic - [x] /topic
- [ ] /version - [ ] /version

View File

@ -3,6 +3,8 @@ $(function() {
var sidebar = $("#sidebar"); var sidebar = $("#sidebar");
var commands = [ var commands = [
"/ame",
"/amsg",
"/close", "/close",
"/connect", "/connect",
"/deop", "/deop",
@ -187,6 +189,7 @@ $(function() {
return; return;
} }
input.val(""); input.val("");
input.prev(".hint").val("");
socket.emit("input", { socket.emit("input", {
id: form.data("target"), id: form.data("target"),
text: text, text: text,

View File

@ -186,6 +186,37 @@ function input(data) {
}); });
break; break;
case "ame":
var type = "action";
case "amsg":
var user = client.me;
var text = args.slice(1).join(" ");
var channels = [];
network.channels.forEach(function(chan) {
if (chan.type == "channel") {
channels.push(chan.name);
var msg = new Msg({
type: type,
from: user,
text: text,
});
chan.messages.push(msg)
sockets.emit("msg", {
id: chan.id,
msg: msg,
});
}
});
client[type || "send"](
channels,
text
);
break;
case "ame":
console.log("AME");
break;
case "server": case "server":
case "connect": case "connect":
if (args[1]) { if (args[1]) {