An 'add to group' script for the Discourse Automation

A somewhat related request that I think has come up a few times is to have some way of dealing with AND logic for category security permissions: Identifying users in multiple groups using AND rather than OR?. In the topic I linked to, they want to create a group for people who are in the trust_level_3 and year_2 groups. This could be accomplished with the Automation plugin now with a custom badge query, but as was noted by Nathan, that’s a messy way of solving the problem. It’s also limited to sites that are able to add custom badge SQL.

I’m posting this here because it might be useful to have requests for scripts related to the user_added_to_group and user_removed_from_group triggers in one topic.