mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-21 08:45:03 +00:00

Rename change_counter automod action to add_to_counter, add set_counter action, rename counter trigger to counter_trigger.
22 lines
611 B
TypeScript
22 lines
611 B
TypeScript
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,
|
|
);
|
|
},
|
|
});
|