mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 04:25:01 +00:00
Add counter documentation/examples. Tweak counter triggers/actions in automod.
Rename change_counter automod action to add_to_counter, add set_counter action, rename counter trigger to counter_trigger.
This commit is contained in:
parent
ab8ea2e7e5
commit
4147298120
9 changed files with 347 additions and 16 deletions
22
backend/src/plugins/Automod/actions/addToCounter.ts
Normal file
22
backend/src/plugins/Automod/actions/addToCounter.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodAction } from "../helpers";
|
||||
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
||||
|
||||
export const AddToCounterAction = automodAction({
|
||||
configType: t.type({
|
||||
counter: t.string,
|
||||
amount: t.number,
|
||||
}),
|
||||
|
||||
defaultConfig: {},
|
||||
|
||||
async apply({ pluginData, contexts, actionConfig, matchResult }) {
|
||||
const countersPlugin = pluginData.getPlugin(CountersPlugin);
|
||||
countersPlugin.changeCounterValue(
|
||||
actionConfig.counter,
|
||||
contexts[0].message?.channel_id || null,
|
||||
contexts[0].user?.id || null,
|
||||
actionConfig.amount,
|
||||
);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue