mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Turn on strict TS compilation. Fix up and tweak types accordingly.
This commit is contained in:
parent
690955a399
commit
629002b8d9
172 changed files with 720 additions and 534 deletions
|
@ -73,15 +73,15 @@ export const MatchAttachmentTypeTrigger = automodTrigger<MatchResultType>()({
|
|||
},
|
||||
|
||||
renderMatchInformation({ pluginData, contexts, matchResult }) {
|
||||
const channel = pluginData.guild.channels.get(contexts[0].message.channel_id);
|
||||
const channel = pluginData.guild.channels.get(contexts[0].message!.channel_id)!;
|
||||
const prettyChannel = verboseChannelMention(channel);
|
||||
|
||||
return (
|
||||
asSingleLine(`
|
||||
Matched attachment type \`${disableInlineCode(matchResult.extra.matchedType)}\`
|
||||
(${matchResult.extra.mode === "blacklist" ? "(blacklisted)" : "(not in whitelist)"})
|
||||
in message (\`${contexts[0].message.id}\`) in ${prettyChannel}:
|
||||
`) + messageSummary(contexts[0].message)
|
||||
in message (\`${contexts[0].message!.id}\`) in ${prettyChannel}:
|
||||
`) + messageSummary(contexts[0].message!)
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import * as t from "io-ts";
|
||||
import { GuildInvite } from "eris";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import {
|
||||
disableCodeBlocks,
|
||||
disableInlineCode,
|
||||
getInviteCodesInString,
|
||||
GuildInvite,
|
||||
isGuildInvite,
|
||||
resolveInvite,
|
||||
tNullable,
|
||||
|
|
|
@ -19,7 +19,7 @@ export const MemberJoinTrigger = automodTrigger<unknown>()({
|
|||
}
|
||||
|
||||
if (triggerConfig.only_new) {
|
||||
const threshold = Date.now() - convertDelayStringToMS(triggerConfig.new_threshold);
|
||||
const threshold = Date.now() - convertDelayStringToMS(triggerConfig.new_threshold)!;
|
||||
return context.member.createdAt >= threshold ? {} : null;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,6 @@ export const MemberJoinTrigger = automodTrigger<unknown>()({
|
|||
},
|
||||
|
||||
renderMatchInformation({ pluginData, contexts, triggerConfig }) {
|
||||
return null;
|
||||
return "";
|
||||
},
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ export const MemberJoinSpamTrigger = automodTrigger<unknown>()({
|
|||
return {};
|
||||
}
|
||||
|
||||
const since = Date.now() - convertDelayStringToMS(triggerConfig.within);
|
||||
const since = Date.now() - convertDelayStringToMS(triggerConfig.within)!;
|
||||
const matchingActions = getMatchingRecentActions(pluginData, RecentActionType.MemberJoin, null, since);
|
||||
const totalCount = sumRecentActionCounts(matchingActions);
|
||||
|
||||
|
@ -46,6 +46,6 @@ export const MemberJoinSpamTrigger = automodTrigger<unknown>()({
|
|||
},
|
||||
|
||||
renderMatchInformation({ pluginData, contexts, triggerConfig }) {
|
||||
return null;
|
||||
return "";
|
||||
},
|
||||
});
|
||||
|
|
|
@ -9,16 +9,16 @@ interface RoleAddedMatchResult {
|
|||
export const RoleAddedTrigger = automodTrigger<RoleAddedMatchResult>()({
|
||||
configType: t.union([t.string, t.array(t.string)]),
|
||||
|
||||
defaultConfig: null,
|
||||
defaultConfig: [],
|
||||
|
||||
async match({ triggerConfig, context, pluginData }) {
|
||||
if (!context.member || !context.rolesChanged || context.rolesChanged.added.length === 0) {
|
||||
if (!context.member || !context.rolesChanged || context.rolesChanged.added!.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const triggerRoles = Array.isArray(triggerConfig) ? triggerConfig : [triggerConfig];
|
||||
for (const roleId of triggerRoles) {
|
||||
if (context.rolesChanged.added.includes(roleId)) {
|
||||
if (context.rolesChanged.added!.includes(roleId)) {
|
||||
if (consumeIgnoredRoleChange(pluginData, context.member.id, roleId)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ interface RoleAddedMatchResult {
|
|||
export const RoleRemovedTrigger = automodTrigger<RoleAddedMatchResult>()({
|
||||
configType: t.union([t.string, t.array(t.string)]),
|
||||
|
||||
defaultConfig: null,
|
||||
defaultConfig: [],
|
||||
|
||||
async match({ triggerConfig, context, pluginData }) {
|
||||
if (!context.member || !context.rolesChanged || context.rolesChanged.removed.length === 0) {
|
||||
if (!context.member || !context.rolesChanged || context.rolesChanged.removed!.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ export const RoleRemovedTrigger = automodTrigger<RoleAddedMatchResult>()({
|
|||
continue;
|
||||
}
|
||||
|
||||
if (context.rolesChanged.removed.includes(roleId)) {
|
||||
if (context.rolesChanged.removed!.includes(roleId)) {
|
||||
return {
|
||||
extra: {
|
||||
matchedRoleId: roleId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue