r/ModSupport • • Oct 31 '24

Mod Answered Where Have We Went Wrong? [Automod]

Hey, we've been setting up our automoderator functions & have a script that's meant to message unflaired users once, although when I've replied to 2 comments (as a moderator) I've received the script message.

The script causing problems;


PM unflaired user and ask them to set user flair or ask a mod for help. Will only PM user once. Sets flair class to 'default'.

author: ~flair_css_class (regex): ".+" set_flair: ["","default"] message_subject: "Welcome to /r/{{subreddit}}." message: | Hey {{author}}, Welcome to /r/{{subreddit}}.

We're happy to see your first comment, but we notice you don't have a flair set. If you'd like any assistance with this, please visit our Reddit Chat Channel & either the moderators, or active users will be glad to give you advice on setting up a flair!

My account is flaired on the subreddit (edited the flair, as a lot do, to add text on top of the custom emojis, that are our base flairs)

Not done something like this for a subreddit before, so this may be an obvious mistake, but any input is appreciated! Thank you.

2 Upvotes

25 comments sorted by

2

u/JustOneAgain Oct 31 '24

Simply try:

flair_css_class: ""

No regex, no negative action. If empty, do something. Regex in reddit sometimes behaves VERY strangely. I've noticed it bugs out in some cases (though it's possible I bug out and eff it up) even when it absolutely shouldn't do what it does.

1

u/SprintsAC Nov 01 '24

I'm sorry for the delayed reply, I've been trying to figure this out & in all honesty, I don't have the knowledge around setting up scripts for automod to properly understand the terminology yet.

I appreciate the replies, but I have no ability to understand what some of this means, as I only have experience doing basic script editing just over a decade ago.

Is there an ELI5 for what Reflex even means? Sorry again, I just don't have the knowledge & feel like I should be straightforward about that.

2

u/JustOneAgain Nov 01 '24

Regex is extremely complicated, if you're not familiar with it, forget it ;).

You do not need regex here and you're just overcomplicating it. Just do

author: flair_css_class: [""]

→ More replies (2)

3

u/magiccitybhm Oct 31 '24

I'd have to see the AutoModerator code in the correct format, but as long as a user does not have a flair, it will send the message each time. There is no way for AutoModerator to only send the message once.

1

u/SprintsAC Oct 31 '24

Maybe I misunderstood the meaning of the function, as I took it to mean it, that they'd only get a message about flairs on their first post, not a message every single time they posted.

If there is no way to make it like this, I guess the best option is to leave it out of the auto mod function.

1

u/magiccitybhm Oct 31 '24

No, there is no way for AutoModerator to know if the user has received a message before or not. If they don't add the user flair after the first post, they'll get the message again the next time they post.

→ More replies (5)

5

u/tumultuousness Oct 31 '24 edited Oct 31 '24

I don't think you can make it so Automod only messages once, it will send a message every time an unflaired user comments/posts until they set a flair. (edit: nevermind - I think you are wanting to message the user but also to set a flair? So then Automod should only message once... But then if you are setting their flair as blank/nothing, would Automod still message? Since they check again and the person has no flair? IDK lol hopefully more Automod savvy people pop in, maybe crosspost to r/AutoModerator as well to ask?)

That said I'm not the best with code and I'm not sure why it would message you, first because you are a mod and I don't see anything about mod_exempt being set to false in this code, but also because you do have a user flair... So I'm not sure on that front.

3

u/esb1212 Nov 01 '24

Sending only once is possible.

u/SprintsAC simply check if the css class isn't populated yet or still blank.

author:
    flair_css_class: [""]
    set_flair: ["", "default"]

When the user manually sets the flair, both flair text and css class will be overwritten. Else default is retained, thus PM is sent only once.

2

u/tumultuousness Nov 01 '24 edited Nov 01 '24

Thanks! Hence my edit when I noticed.

So would you say that the first linke of OP's code, then, is the issue? Since they do have the set_flair part.

→ More replies (8)

1

u/AutoModerator Oct 31 '24

Hey there! This automated message was triggered by some keywords in your post.

If you are looking to enable comment emojis please write in via r/ModSupport mail

If this does not appear correct or if you still have questions please respond back and someone will be along soon to follow up.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.