Akismet: Use for existing posts?

Hi, a quick question.

Do you think Discourse Akismet can somehow be used to detect spam in the existing posts?

I’m importing a forum with a lot of spam and I can’t clean it up all before importing to Discourse.


I think that I might do that it in import script, though I’m not quite sure just how.


It’s possible, but I think you’ll have to make changes to the import script.

You’ll need to be able to instantiate this class in the script:

You may need to copy the code and adapt it to work without Discourse specific code like Discourse.base_url, SiteSetting.akismet_api_key, etc.

The client #comment_check method expects a body, so you’ll have to build something like this:

More info about this here.

Then you could do something like this:

# Check if a post is spam.
client = Akismet.build_client
body = <your code>

is_spam = client.comment_check(body)