mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-25 02:25:01 +00:00
fix typings UwU
This commit is contained in:
parent
c541063ef3
commit
42c56db858
1 changed files with 6 additions and 3 deletions
|
@ -1,17 +1,20 @@
|
||||||
import { Permissions, PermissionString } from "discord.js";
|
import { Permissions, PermissionString } from "discord.js";
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
import { automodAction } from "../helpers";
|
||||||
import { tNullable, isValidSnowflake } from "../../../utils";
|
import { tNullable, isValidSnowflake, tPartialDictionary } from "../../../utils";
|
||||||
import { noop } from "knub/dist/utils";
|
import { noop } from "knub/dist/utils";
|
||||||
|
|
||||||
export const ChangePermsAction = automodAction({
|
export const ChangePermsAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
target: t.string,
|
target: t.string,
|
||||||
channel: tNullable(t.string),
|
channel: tNullable(t.string),
|
||||||
perms: t.record(t.keyof(Permissions.FLAGS), t.union([t.boolean, t.null])),
|
perms: tPartialDictionary(t.keyof(Permissions.FLAGS), tNullable(t.boolean)),
|
||||||
}),
|
}),
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
channel: "",
|
channel: "",
|
||||||
|
perms: {
|
||||||
|
SEND_MESSAGES: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async apply({ pluginData, contexts, actionConfig, ruleName }) {
|
async apply({ pluginData, contexts, actionConfig, ruleName }) {
|
||||||
|
@ -50,7 +53,7 @@ export const ChangePermsAction = automodAction({
|
||||||
for (const key in actionConfig.perms) {
|
for (const key in actionConfig.perms) {
|
||||||
perms[key] = actionConfig.perms[key];
|
perms[key] = actionConfig.perms[key];
|
||||||
}
|
}
|
||||||
const permsArray: PermissionString[] = <any>Object.keys(perms).filter((key) => perms[key]);
|
const permsArray = <PermissionString[]>Object.keys(perms).filter((key) => perms[key]);
|
||||||
await role.setPermissions(new Permissions(permsArray)).catch(noop);
|
await role.setPermissions(new Permissions(permsArray)).catch(noop);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue