Automod
ordinaryjellyfish/automod
Empower your forum with AI automod tools powered by Google Cloud's NLP API.
- Downloads
- 2
- Subscribers
- 0
Plan comparison
Plans
Subscribe to any of the available plans below.
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
}
}
}
Versions
-
Version 0.2.0.
Likely works with Flarum v1.8.5.
-
1 additional versions.
-
Extension created.