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
These are the commands currently implemented:
- [ ] /ame
- [ ] /amsg
- [x] /ame
- [x] /amsg
- [x] /close
- [x] /connect
- [x] /deop
@ -29,6 +29,7 @@ These are the commands currently implemented:
- [x] /say
- [x] /send
- [x] /server
- [ ] /slap
- [ ] /time
- [x] /topic
- [ ] /version

View File

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

View File

@ -186,6 +186,37 @@ function input(data) {
});
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 "connect":
if (args[1]) {