kick: use the user object

This commit is contained in:
Reto Brunner 2024-04-15 07:52:58 +02:00
parent edb96f683b
commit 92a0affba1

View file

@ -1,7 +1,6 @@
import {IrcEventHandler} from "../../client";
import Msg from "../../models/msg";
import User from "../../models/user";
import {MessageType} from "../../../shared/types/msg";
import {ChanState} from "../../../shared/types/chan";
@ -15,11 +14,12 @@ export default <IrcEventHandler>function (irc, network) {
return;
}
const user = chan.getUser(data.kicked!);
const msg = new Msg({
type: MessageType.KICK,
time: data.time,
from: chan.getUser(data.nick),
target: chan.getUser(data.kicked!),
target: user,
text: data.message || "",
highlight: data.kicked === irc.user.nick,
self: data.nick === irc.user.nick,
@ -35,7 +35,7 @@ export default <IrcEventHandler>function (irc, network) {
state: chan.state,
});
} else {
chan.removeUser(msg.target as User);
chan.removeUser(user);
}
});
};