mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 09:35:02 +00:00
shorten the line!
This commit is contained in:
parent
39fc748982
commit
ac8284ade0
1 changed files with 4 additions and 10 deletions
|
@ -3,9 +3,8 @@ import { TextChannel } from "discord.js";
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
|
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
|
||||||
import { ChannelTypeStrings } from "src/types";
|
import { ChannelTypeStrings } from "src/types";
|
||||||
import { convertDelayStringToMS, MINUTES, tDelayString, tNullable } from "../../../utils";
|
import { convertDelayStringToMS, MINUTES, tDelayString, tNullable, noop } from "../../../utils";
|
||||||
import { savedMessageToTemplateSafeSavedMessage, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
import { savedMessageToTemplateSafeSavedMessage, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||||
import { noop } from "../../../utils";
|
|
||||||
import { automodAction } from "../helpers";
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const StartThreadAction = automodAction({
|
export const StartThreadAction = automodAction({
|
||||||
|
@ -29,14 +28,9 @@ export const StartThreadAction = automodAction({
|
||||||
if (channel?.type !== ChannelTypeStrings.TEXT || !channel.isText()) return false; // for some reason the typing here for channel.type defaults to ThreadChannelTypes (?)
|
if (channel?.type !== ChannelTypeStrings.TEXT || !channel.isText()) return false; // for some reason the typing here for channel.type defaults to ThreadChannelTypes (?)
|
||||||
// check against max threads per channel
|
// check against max threads per channel
|
||||||
if (actionConfig.limit_per_channel && actionConfig.limit_per_channel > 0) {
|
if (actionConfig.limit_per_channel && actionConfig.limit_per_channel > 0) {
|
||||||
const threadCount = [
|
const threadCount = channel.threads.cache.filter(
|
||||||
...channel.threads.cache
|
tr => tr.ownerId === pluginData.client.user!.id && !tr.deleted && !tr.archived && tr.parentId === channel.id,
|
||||||
.filter(
|
).size;
|
||||||
tr =>
|
|
||||||
tr.ownerId === pluginData.client.user!.id && !tr.deleted && !tr.archived && tr.parentId === channel.id,
|
|
||||||
)
|
|
||||||
.keys(),
|
|
||||||
].length; // very short line, yes yes
|
|
||||||
if (threadCount >= actionConfig.limit_per_channel) return false;
|
if (threadCount >= actionConfig.limit_per_channel) return false;
|
||||||
}
|
}
|
||||||
return channel.messages.cache.has(c.message.id);
|
return channel.messages.cache.has(c.message.id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue