So, we gave a lot of thought on this use case over the years. The reason you have to write bots in Discord is because you are kinda putting a square peg in round hole, and doing this weird UX because there is nothing better.
On Discourse, you will be able to configure Discourse Automation to achieve the same use case, and be able to get the group/role assignment in ways that may make more sense for your users, like voting in poll or replying to a message in a chat.