mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 22:01:50 +00:00
check props on run loop
This commit is contained in:
parent
9406136861
commit
b2755a754b
2 changed files with 6 additions and 4 deletions
|
@ -15,12 +15,13 @@ export const ArchiveThreadAction = automodAction({
|
|||
const threads = contexts
|
||||
.filter((c) => c.message?.channel_id)
|
||||
.map((c) => pluginData.guild.channels.cache.get(c.message!.channel_id))
|
||||
.filter((c): c is ThreadChannel => (c?.isThread() && !c.archived) ?? false);
|
||||
.filter((c): c is ThreadChannel => c?.isThread() ?? false);
|
||||
|
||||
for (const thread of threads) {
|
||||
if (actionConfig.lock) {
|
||||
if (actionConfig.lock && !thread.locked) {
|
||||
await thread.setLocked().catch(noop);
|
||||
}
|
||||
if (thread.archived) continue;
|
||||
await thread.setArchived().catch(noop);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -15,12 +15,13 @@ export const UnArchiveThreadAction = automodAction({
|
|||
const threads = contexts
|
||||
.filter((c) => c.message?.channel_id)
|
||||
.map((c) => pluginData.guild.channels.cache.get(c.message!.channel_id))
|
||||
.filter((c): c is ThreadChannel => (c?.isThread() && c.archived) ?? false);
|
||||
.filter((c): c is ThreadChannel => c?.isThread() ?? false);
|
||||
|
||||
for (const thread of threads) {
|
||||
if (actionConfig.unlock) {
|
||||
if (actionConfig.unlock && thread.locked) {
|
||||
await thread.setLocked(false).catch(noop);
|
||||
}
|
||||
if (!thread.archived) continue;
|
||||
await thread.setArchived(false).catch(noop);
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue