mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Merge remote-tracking branch 'origin/master' into 220601_docker_wip
This commit is contained in:
commit
177a66a247
7 changed files with 18 additions and 25 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { GuildFeature, ThreadAutoArchiveDuration } from "discord-api-types";
|
import { GuildFeature, ThreadAutoArchiveDuration } from "discord-api-types/v9";
|
||||||
import { TextChannel } from "discord.js";
|
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";
|
||||||
|
@ -7,6 +7,13 @@ import { convertDelayStringToMS, MINUTES, noop, tDelayString, tNullable } from "
|
||||||
import { savedMessageToTemplateSafeSavedMessage, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
import { savedMessageToTemplateSafeSavedMessage, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||||
import { automodAction } from "../helpers";
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
|
const validThreadAutoArchiveDurations: ThreadAutoArchiveDuration[] = [
|
||||||
|
ThreadAutoArchiveDuration.OneHour,
|
||||||
|
ThreadAutoArchiveDuration.OneDay,
|
||||||
|
ThreadAutoArchiveDuration.ThreeDays,
|
||||||
|
ThreadAutoArchiveDuration.OneWeek,
|
||||||
|
];
|
||||||
|
|
||||||
export const StartThreadAction = automodAction({
|
export const StartThreadAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
name: tNullable(t.string),
|
name: tNullable(t.string),
|
||||||
|
@ -41,22 +48,9 @@ export const StartThreadAction = automodAction({
|
||||||
const archiveSet = actionConfig.auto_archive
|
const archiveSet = actionConfig.auto_archive
|
||||||
? Math.ceil(Math.max(convertDelayStringToMS(actionConfig.auto_archive) ?? 0, 0) / MINUTES)
|
? Math.ceil(Math.max(convertDelayStringToMS(actionConfig.auto_archive) ?? 0, 0) / MINUTES)
|
||||||
: ThreadAutoArchiveDuration.OneDay;
|
: ThreadAutoArchiveDuration.OneDay;
|
||||||
let autoArchive: ThreadAutoArchiveDuration;
|
const autoArchive = validThreadAutoArchiveDurations.includes(archiveSet)
|
||||||
if (archiveSet === ThreadAutoArchiveDuration.OneDay) {
|
? (archiveSet as ThreadAutoArchiveDuration)
|
||||||
autoArchive = ThreadAutoArchiveDuration.OneDay;
|
: ThreadAutoArchiveDuration.OneHour;
|
||||||
} else if (
|
|
||||||
archiveSet === ThreadAutoArchiveDuration.ThreeDays &&
|
|
||||||
guild.features.includes(GuildFeature.ThreeDayThreadArchive)
|
|
||||||
) {
|
|
||||||
autoArchive = ThreadAutoArchiveDuration.ThreeDays;
|
|
||||||
} else if (
|
|
||||||
archiveSet === ThreadAutoArchiveDuration.OneWeek &&
|
|
||||||
guild.features.includes(GuildFeature.SevenDayThreadArchive)
|
|
||||||
) {
|
|
||||||
autoArchive = ThreadAutoArchiveDuration.OneWeek;
|
|
||||||
} else {
|
|
||||||
autoArchive = ThreadAutoArchiveDuration.OneHour;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const threadContext of threads) {
|
for (const threadContext of threads) {
|
||||||
const channel = pluginData.guild.channels.cache.get(threadContext.message!.channel_id) as TextChannel;
|
const channel = pluginData.guild.channels.cache.get(threadContext.message!.channel_id) as TextChannel;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Snowflake } from "discord-api-types";
|
import { Snowflake } from "discord-api-types/v9";
|
||||||
import { User, Util } from "discord.js";
|
import { User, Util } from "discord.js";
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { tNullable } from "../../../utils";
|
import { tNullable } from "../../../utils";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Snowflake } from "discord-api-types";
|
import { Snowflake } from "discord-api-types/v9";
|
||||||
import { User, Util } from "discord.js";
|
import { User, Util } from "discord.js";
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodTrigger } from "../helpers";
|
import { automodTrigger } from "../helpers";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Snowflake } from "discord-api-types";
|
import { Snowflake } from "discord-api-types/v9";
|
||||||
import { User, Util } from "discord.js";
|
import { User, Util } from "discord.js";
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodTrigger } from "../helpers";
|
import { automodTrigger } from "../helpers";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Snowflake } from "discord-api-types";
|
import { Snowflake } from "discord-api-types/v9";
|
||||||
import { User, Util } from "discord.js";
|
import { User, Util } from "discord.js";
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { tNullable } from "../../../utils";
|
import { tNullable } from "../../../utils";
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { GuildTextBasedChannel, Message, MessageOptions, NewsChannel, TextChannel, WebhookClient } from "discord.js";
|
import { GuildTextBasedChannel, MessageOptions, WebhookClient } from "discord.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { InternalPosterPluginType } from "../types";
|
import { InternalPosterPluginType } from "../types";
|
||||||
import { channelIsWebhookable, getOrCreateWebhookForChannel } from "./getOrCreateWebhookForChannel";
|
import { channelIsWebhookable } from "./getOrCreateWebhookForChannel";
|
||||||
import { APIMessage } from "discord-api-types";
|
|
||||||
import { isDiscordAPIError } from "../../../utils";
|
import { isDiscordAPIError } from "../../../utils";
|
||||||
import { getOrCreateWebhookClientForChannel } from "./getOrCreateWebhookClientForChannel";
|
import { getOrCreateWebhookClientForChannel } from "./getOrCreateWebhookClientForChannel";
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ const MAX_ROLES_TO_DISPLAY = 15;
|
||||||
|
|
||||||
const trimRoles = (roles: string[]) =>
|
const trimRoles = (roles: string[]) =>
|
||||||
roles.length > MAX_ROLES_TO_DISPLAY
|
roles.length > MAX_ROLES_TO_DISPLAY
|
||||||
? roles.slice(0, MAX_ROLES_TO_DISPLAY).join(", ") + `, and ${MAX_ROLES_TO_DISPLAY - roles.length} more roles`
|
? roles.slice(0, MAX_ROLES_TO_DISPLAY).join(", ") + `, and ${roles.length - MAX_ROLES_TO_DISPLAY} more roles`
|
||||||
: roles.join(", ");
|
: roles.join(", ");
|
||||||
|
|
||||||
export async function getUserInfoEmbed(
|
export async function getUserInfoEmbed(
|
||||||
|
|
Loading…
Add table
Reference in a new issue