fix msg event

This commit is contained in:
Reto Brunner 2024-03-01 08:19:48 +01:00
parent 8e6920af1d
commit 7073584f1c
2 changed files with 7 additions and 3 deletions

View file

@ -123,12 +123,14 @@ function notifyMessage(
) { ) {
let title: string; let title: string;
let body: string; let body: string;
// TODO: fix msg type and get rid of that conditional
const nick = msg.from && msg.from.nick ? msg.from.nick : "unkonown";
if (msg.type === "invite") { if (msg.type === "invite") {
title = "New channel invite:"; title = "New channel invite:";
body = msg.from.nick + " invited you to " + msg.channel; body = nick + " invited you to " + msg.channel;
} else { } else {
title = String(msg.from.nick); title = nick;
if (channel.type !== "query") { if (channel.type !== "query") {
title += ` (${channel.name})`; title += ` (${channel.name})`;
@ -138,7 +140,8 @@ function notifyMessage(
title += " says:"; title += " says:";
} }
body = cleanIrcMessage(msg.text); // TODO: fix msg type and get rid of that conditional
body = cleanIrcMessage(msg.text ? msg.text : "");
} }
const timestamp = Date.parse(String(msg.time)); const timestamp = Date.parse(String(msg.time));

View file

@ -100,4 +100,5 @@ export type SharedMsg = {
export type ClientMessage = Omit<SharedMsg, "users"> & { export type ClientMessage = Omit<SharedMsg, "users"> & {
time: Date; time: Date;
users: string[]; users: string[];
id: number;
}; };