Use bot for kicking if necessary

This commit is contained in:
Tulir Asokan 2024-03-01 13:34:27 +02:00
parent 04828bef39
commit 69764df5f8

View file

@ -1362,6 +1362,12 @@ func (portal *Portal) SyncParticipants(ctx context.Context, source *User, metada
UserID: userID, UserID: userID,
Reason: "User is not participating in chat", Reason: "User is not participating in chat",
}) })
if errors.Is(err, mautrix.MForbidden) && portal.MainIntent() != portal.bridge.Bot {
_, err = portal.bridge.Bot.KickUser(ctx, portal.MXID, &mautrix.ReqKickUser{
UserID: userID,
Reason: "User is not participating in chat",
})
}
if err != nil { if err != nil {
portal.zlog.Warn().Err(err). portal.zlog.Warn().Err(err).
Str("user_id", userID.String()). Str("user_id", userID.String()).