proper routing
This commit is contained in:
parent
cb69e8fd48
commit
4995d57219
@ -39,13 +39,19 @@ module.exports = function(remote, events){
|
|||||||
if (event.type != "privmsg")
|
if (event.type != "privmsg")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//TODO: map ingame channel
|
var channel = "";
|
||||||
|
Object.keys(remote.channels).forEach(ingame_channel => {
|
||||||
|
const irc_channel = remote.channels[ingame_channel];
|
||||||
|
if (irc_channel == event.target){
|
||||||
|
channel = ingame_channel;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
events.emit("message-in", {
|
events.emit("message-in", {
|
||||||
type: "irc",
|
type: "irc",
|
||||||
name: remote.name,
|
name: remote.name,
|
||||||
username: event.nick,
|
username: event.nick,
|
||||||
channel: event.target,
|
channel: ingame_channel,
|
||||||
message: event.message
|
message: event.message
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@ -61,7 +67,7 @@ module.exports = function(remote, events){
|
|||||||
|
|
||||||
const channel = channels[event.channel]
|
const channel = channels[event.channel]
|
||||||
if (channel) {
|
if (channel) {
|
||||||
channel.say(`<${event.username}> ${event.message}`)
|
channel.say(`<${event.username}${event.type == "minetest" ? "" : event.type}> ${event.message}`)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ module.exports = function(remotes, events){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dispatch to remotes
|
||||||
events.emit("message-out", {
|
events.emit("message-out", {
|
||||||
type: event.type,
|
type: event.type,
|
||||||
name: remote.name,
|
name: remote.name,
|
||||||
@ -17,6 +18,17 @@ module.exports = function(remotes, events){
|
|||||||
message: event.message
|
message: event.message
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (event.type != "minetest") {
|
||||||
|
// dispatch to ingame too
|
||||||
|
events.emit("message-out", {
|
||||||
|
type: event.type,
|
||||||
|
name: "minetest",
|
||||||
|
username: event.username,
|
||||||
|
channel: event.channel,
|
||||||
|
message: event.message
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user