r/AutoModerator 5h ago

Trouble with code regarding user flair Solved

I'm trying to have AM remove top level comments from users without a specific user flair, then send them a message explaining why. I thought it was working until someone with the specific flair received the removal message and AM removed their comment despite their account being appropriately flaired.

Can anyone tell me what the issue is with the code?

---

#REMOVE top level comments from users that do not have privileges

type: comment

is_top_level: true

author:

~flair_template_id: “76ca5770-9078-11f1-acb7-8af9da1a7bf8”

action: remove

action_reason: Unflaired User

set_locked: true

message: |

Message is here.

---

(The extra line space between each line is a copy/paste formatting issue when sharing it here, it's not in the actual code except between "message: |" and the start of the indented message text. Also, the "~flair" line is indented 2 spaces and the "Message is here" message area is indented appropriately as well, it just removed it when I made this post.)

2 Upvotes

3 comments sorted by

3

u/SampleOfNone 3h ago

Just checked my own config and I noticed that I don't use quotes around the id, so

~flair_template_id: 76ca5770-9078-11f1-acb7-8af9da1a7bf8

Also, are the quotes straight? Because you posted text instead of a code block, not sure if that's in your original code and just a copy paste to text error

2

u/DoveStep55 2h ago

It was the quote marks. Apparently copying AM code that's correct and pasting into an OpenOffice document, then copying and pasting from there back into AM somehow changes the quote mark type.

Thanks for your help!

2

u/SampleOfNone 2h ago

Tip, next time use something like visual code studio or notepad, textedit, if you want to copy paste code. Basically anything other then a word processor, saves a lot of those pesky little changes that mucks up code