engine: a kicked services bot rejoins its assigned channel

A PART/KICK of a bot uid updated channel membership but not bot_channels,
so reconcile still believed the bot was present and never rejoined it — an
op could evict a services bot for good. The Part handler now drops the stale
membership and reconciles, so a bot assigned to the channel comes right back.
This commit is contained in:
Jean Chevronnet 2026-07-16 10:03:00 +00:00
parent 7e868babc3
commit a9a3408de0
No known key found for this signature in database
2 changed files with 46 additions and 0 deletions

View file

@ -981,6 +981,14 @@ impl Engine {
NetEvent::Part { uid, channel } => {
self.network.channel_part(&channel, &uid);
self.forget_chatter(&channel, &uid);
// A services bot kicked/parted from a channel it's still assigned
// to rejoins — an op can't evict it. Drop the stale membership so
// reconcile re-adds it.
if let Some(bot_lc) = self.bot_uids.iter().find_map(|(lc, u)| (u == &uid).then(|| lc.clone())) {
if self.bot_channels.remove(&(bot_lc, channel.clone())) {
return self.reconcile_bots();
}
}
Vec::new()
}
NetEvent::ChannelOp { channel, uid, op } => {