Automod

Empower your forum with AI automod tools powered by Google Cloud's NLP API.

Automod

Compatible with Flarum v1.8.5

Latest release 0.2.0

1 subscriber

2 downloads

released on Feb 13, 2024

$20.00 per month
extended
for profit
$10.00 per month
standard
not for profit
$99.00 per year
standard
not for profit

Automod

A Flarum extension. Empower your forum with AI automod tools powered by Google Cloud's NLP API.

Installation

Install with composer:

composer require ordinaryjellyfish/automod:"*"

Updating

composer update ordinaryjellyfish/automod:"*"
php flarum migrate
php flarum cache:clear

Links

Usage

This extension makes heavy use of Google Cloud APIs. You will need to enable billing on your project to use this. Everything used in this extension has free quotas, but be mindful of how busy your forum is as you may incur extra expenses.

You will need to enable both the Natural Language API and the Cloud Vision API. You will also need to create a service account and download the JSON key file. You can input the contents in the proper setting in the admin panel.

That's it! You're all set!

Creating Your Own Filter

To create your own filter, you'll need to use the Filter extender inside your extend.php file:

use OrdinaryJellyfish\Automod\Extend\Filter;

return [
    (new Filter())
        ->add(YourFilter::class)
];

You can then create a class to analyze text and images and pass it on to flag.

use Flarum\Post\Event\Saving;
use Flarum\Settings\SettingsRepositoryInterface;
use OrdinaryJellyfish\Automod\Api\Language;
use OrdinaryJellyfish\Automod\Api\Vision;

class YourFilter
{
    public function __construct(SettingsRepositoryInterface $settings)
    {
        $this->settings = $settings;
    }

    public function getName(): string
    {
        return 'Name Of Your Filter'; // This is what will show up on the flag reasoning
    }

    public function analyze(Saving $event, Language $language, Vision $vision): bool
    {
        if ($this->settings->get('my-setting')) {
            // Do something
        }
    }
}

© 2024 Hyn by DaniĆ«l "Luceos" Klabbers. All rights reserved. · Extensions and extension information is provided by the respective (copyright holding) authors. · Extiverse is not affiliated to the Flarum project or Flarum foundation. · Images on Extiverse pages are from Unsplash.