mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 17:45:03 +00:00
oops
This commit is contained in:
parent
e684722908
commit
eb2c9911e4
1 changed files with 0 additions and 27 deletions
|
@ -1,27 +0,0 @@
|
|||
import { ThreadChannel } from "discord.js";
|
||||
import * as t from "io-ts";
|
||||
import { noop, tNullable } from "../../../utils";
|
||||
import { automodAction } from "../helpers";
|
||||
|
||||
export const UnArchiveThreadAction = automodAction({
|
||||
configType: t.type({
|
||||
unlock: tNullable(t.boolean),
|
||||
}),
|
||||
defaultConfig: {
|
||||
unlock: false,
|
||||
},
|
||||
|
||||
async apply({ pluginData, contexts, actionConfig }) {
|
||||
const threads = contexts
|
||||
.filter(c => c.thread?.id)
|
||||
.map(c => pluginData.guild.channels.cache.get(c.thread!.id))
|
||||
.filter((c): c is ThreadChannel => (c?.isThread() && c.archived) ?? false);
|
||||
|
||||
for (const thread of threads) {
|
||||
if (actionConfig.unlock) {
|
||||
await thread.setLocked(false).catch(noop);
|
||||
}
|
||||
await thread.setArchived(false).catch(noop);
|
||||
}
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue