2020-09-02 10:57:12 +01:00
|
|
|
const osu = require("osu-packet"),
|
|
|
|
getUserByUsername = require("../util/getUserByUsername.js");
|
|
|
|
|
|
|
|
module.exports = function(CurrentPacket, CurrentUser) {
|
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
|
|
|
|
|
|
|
osuPacketWriter.SendMessage({
|
|
|
|
sendingClient: CurrentUser.username,
|
|
|
|
message: CurrentPacket.data.message,
|
2020-09-02 11:28:50 +01:00
|
|
|
target: CurrentUser.username,
|
2020-09-02 10:57:12 +01:00
|
|
|
senderId: CurrentUser.id
|
|
|
|
});
|
|
|
|
|
|
|
|
const userSentTo = getUserByUsername(CurrentPacket.data.target);
|
|
|
|
|
|
|
|
// Write chat message to stream asociated with chat channel
|
|
|
|
return userSentTo.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
}
|