Discord is not open-source, so I don't see how it's relevant; it's "communities" are primarily gamers & streamers. While there are some open-source communities based on Discord, the same goes for other closed-source platforms such as Slack & Telegram, and I'm sure the number of software development communities on Slack is (sadly) much larger than on Discord.
Of actual open-source options: Gitter, Discourse, Rocket, Mattermost, etc. - Matrix would seem to be competing relatively well.
I'm pretty sure Telegram is open-source (at least the client)
An open-source client would be relevant for something P2P like SSB/Manyverse*, but for all other tech the sourcecode of the server will be your primary concern.
* And even with something like Manyverse, the sourcecode of things commonly used as "de facto servers", like SSB "pubs", ends up still being extremely relevant in practice just because of the UX of using the platform.
Gitter was bought by Element, it's effectively a Matrix client now.
Discord is... for folks who have got lost.
Very few new communities are setting up on IRC. My impression is that until the Freenode meltdown, Discord was most common, followed by Matrix, then Slack, but the freenode disaster seems to have benefited Matrix more than Discord or Slack.
That's if you look at official channels, if you look at user counts in unofficial community groups as well, Discord has to be way in the lead. The Python community discord has about as many online users as Libera in its entirety, for example.