3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-13 21:35:02 +00:00

djs typings: Attachment & Util

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
metal 2023-03-11 14:41:04 +00:00 committed by GitHub
parent aad4ad82a5
commit 010451c7e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 49 additions and 44 deletions

View file

@ -1,4 +1,4 @@
import { Snowflake, TextChannel, Util } from "discord.js";
import { escapeInlineCode, Snowflake, TextChannel } from "discord.js";
import * as t from "io-ts";
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils";
import { automodTrigger } from "../helpers";
@ -71,7 +71,7 @@ export const MatchAttachmentTypeTrigger = automodTrigger<MatchResultType>()({
return (
asSingleLine(`
Matched attachment type \`${Util.escapeInlineCode(matchResult.extra.matchedType)}\`
Matched attachment type \`${escapeInlineCode(matchResult.extra.matchedType)}\`
(${matchResult.extra.mode === "blacklist" ? "blacklisted" : "not in whitelist"})
in message (\`${contexts[0].message!.id}\`) in ${prettyChannel}:
`) + messageSummary(contexts[0].message!)

View file

@ -1,4 +1,3 @@
import { Util } from "discord.js";
import escapeStringRegexp from "escape-string-regexp";
import * as t from "io-ts";
import { allowTimeout } from "../../../RegExpRunner";
@ -11,6 +10,7 @@ import { mergeRegexes } from "../../../utils/mergeRegexes";
import { mergeWordsIntoRegex } from "../../../utils/mergeWordsIntoRegex";
import { PhishermanPlugin } from "../../Phisherman/PhishermanPlugin";
import { phishermanDomainIsSafe } from "../../../data/Phisherman";
import { escapeInlineCode } from "discord.js";
interface MatchResultType {
type: MatchableTextType;
@ -186,7 +186,7 @@ export const MatchLinksTrigger = automodTrigger<MatchResultType>()({
renderMatchInformation({ pluginData, contexts, matchResult }) {
const partialSummary = getTextMatchPartialSummary(pluginData, matchResult.extra.type, contexts[0]);
let information = `Matched link \`${Util.escapeInlineCode(matchResult.extra.link)}\``;
let information = `Matched link \`${escapeInlineCode(matchResult.extra.link)}\``;
if (matchResult.extra.details) {
information += ` ${matchResult.extra.details}`;
}

View file

@ -1,7 +1,7 @@
import { automodTrigger } from "../helpers";
import * as t from "io-ts";
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils";
import { GuildChannel, Util } from "discord.js";
import { escapeInlineCode, GuildChannel } from "discord.js";
interface MatchResultType {
matchedType: string;
@ -71,7 +71,7 @@ export const MatchMimeTypeTrigger = automodTrigger<MatchResultType>()({
return (
asSingleLine(`
Matched MIME type \`${Util.escapeInlineCode(matchedType)}\`
Matched MIME type \`${escapeInlineCode(matchedType)}\`
(${mode === "blacklist" ? "blacklisted" : "not in whitelist"})
in message (\`${message!.id}\`) in ${prettyChannel}
`) + messageSummary(message!)

View file

@ -1,4 +1,3 @@
import { Util } from "discord.js";
import escapeStringRegexp from "escape-string-regexp";
import * as t from "io-ts";
import { normalizeText } from "../../../utils/normalizeText";

View file

@ -1,5 +1,5 @@
import { Snowflake } from "discord-api-types/v9";
import { User, Util } from "discord.js";
import { escapeBold, User } from "discord.js";
import * as t from "io-ts";
import { tNullable } from "../../../utils";
import { automodTrigger } from "../helpers";
@ -49,7 +49,7 @@ export const ThreadArchiveTrigger = automodTrigger<ThreadArchiveResult>()({
const parentName = matchResult.extra.matchedThreadParentName;
const base = `Thread **#${threadName}** (\`${threadId}\`) has been archived in the **#${parentName}** (\`${parentId}\`) channel`;
if (threadOwner) {
return `${base} by **${Util.escapeBold(threadOwner.tag)}** (\`${threadOwner.id}\`)`;
return `${base} by **${escapeBold(threadOwner.tag)}** (\`${threadOwner.id}\`)`;
}
return base;
},

View file

@ -1,5 +1,5 @@
import { Snowflake } from "discord-api-types/v9";
import { User, Util } from "discord.js";
import { escapeBold, User } from "discord.js";
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
@ -41,7 +41,7 @@ export const ThreadCreateTrigger = automodTrigger<ThreadCreateResult>()({
const parentName = matchResult.extra.matchedThreadParentName;
const base = `Thread **#${threadName}** (\`${threadId}\`) has been created in the **#${parentName}** (\`${parentId}\`) channel`;
if (threadOwner) {
return `${base} by **${Util.escapeBold(threadOwner.tag)}** (\`${threadOwner.id}\`)`;
return `${base} by **${escapeBold(threadOwner.tag)}** (\`${threadOwner.id}\`)`;
}
return base;
},

View file

@ -1,5 +1,5 @@
import { Snowflake } from "discord-api-types/v9";
import { User, Util } from "discord.js";
import { escapeBold, User } from "discord.js";
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
@ -40,7 +40,7 @@ export const ThreadDeleteTrigger = automodTrigger<ThreadDeleteResult>()({
const parentId = matchResult.extra.matchedThreadParentId;
const parentName = matchResult.extra.matchedThreadParentName;
if (threadOwner) {
return `Thread **#${threadName ?? "Unknown"}** (\`${threadId}\`) created by **${Util.escapeBold(
return `Thread **#${threadName ?? "Unknown"}** (\`${threadId}\`) created by **${escapeBold(
threadOwner.tag,
)}** (\`${threadOwner.id}\`) in the **#${parentName}** (\`${parentId}\`) channel has been deleted`;
}

View file

@ -1,5 +1,5 @@
import { Snowflake } from "discord-api-types/v9";
import { User, Util } from "discord.js";
import { escapeBold, User } from "discord.js";
import * as t from "io-ts";
import { tNullable } from "../../../utils";
import { automodTrigger } from "../helpers";
@ -49,7 +49,7 @@ export const ThreadUnarchiveTrigger = automodTrigger<ThreadUnarchiveResult>()({
const parentName = matchResult.extra.matchedThreadParentName;
const base = `Thread **#${threadName}** (\`${threadId}\`) has been unarchived in the **#${parentName}** (\`${parentId}\`) channel`;
if (threadOwner) {
return `${base} by **${Util.escapeBold(threadOwner.tag)}** (\`${threadOwner.id}\`)`;
return `${base} by **${escapeBold(threadOwner.tag)}** (\`${threadOwner.id}\`)`;
}
return base;
},