proper routing
This commit is contained in:
parent
cb69e8fd48
commit
4995d57219
@ -39,13 +39,19 @@ module.exports = function(remote, events){
|
||||
if (event.type != "privmsg")
|
||||
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", {
|
||||
type: "irc",
|
||||
name: remote.name,
|
||||
username: event.nick,
|
||||
channel: event.target,
|
||||
channel: ingame_channel,
|
||||
message: event.message
|
||||
})
|
||||
});
|
||||
@ -61,7 +67,7 @@ module.exports = function(remote, events){
|
||||
|
||||
const channel = channels[event.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;
|
||||
}
|
||||
|
||||
// dispatch to remotes
|
||||
events.emit("message-out", {
|
||||
type: event.type,
|
||||
name: remote.name,
|
||||
@ -17,6 +18,17 @@ module.exports = function(remotes, events){
|
||||
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