Matrix could be a good option: it supports encryption, self-hosting, though do not support topics in a way that Discord does, in terms of UX. There is also a Discord-like platform called Stoat. It does not support forum-type channels but the UI and UX is very similar to Discord and it is also a self-hosted platform. However, I am not aware of security part of it, it is easy to check. Self-hosting is always a quite a challenge to maintain, no matter what platform you choose. Matrix, on the other hand, is designed around security very hard, so I definitely would trust my data and security more to this platform.
Matrix could be a good option: it supports encryption, self-hosting, though do not support topics in a way that Discord does, in terms of UX. There is also a Discord-like platform called Stoat. It does not support forum-type channels but the UI and UX is very similar to Discord and it is also a self-hosted platform. However, I am not aware of security part of it, it is easy to check. Self-hosting is always a quite a challenge to maintain, no matter what platform you choose. Matrix, on the other hand, is designed around security very hard, so I definitely would trust my data and security more to this platform.