3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Update to new Knub 30 beta. Code clean-up.

This commit is contained in:
Dragory 2020-10-01 01:43:38 +03:00
parent 5d579446c5
commit 2f470dc37a
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
299 changed files with 1075 additions and 1004 deletions

View file

@ -1,18 +1,18 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage, hasPermission, sendSuccessMessage } from "../../../pluginUtils";
import { resolveUser, resolveMember, stripObjectToScalars } from "../../../utils";
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
import { CaseTypes } from "src/data/CaseTypes";
import { CasesPlugin } from "src/plugins/Cases/CasesPlugin";
import { Case } from "src/data/entities/Case";
import { LogType } from "src/data/LogType";
import { CaseTypes } from "../../../data/CaseTypes";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { Case } from "../../../data/entities/Case";
import { LogType } from "../../../data/LogType";
const opts = {
mod: ct.member({ option: true }),
};
export const AddCaseCmd = modActionsCommand({
export const AddCaseCmd = modActionsCmd({
trigger: "addcase",
permission: "can_addcase",
description: "Add an arbitrary case to the specified user without taking any action",

View file

@ -1,4 +1,4 @@
import { modActionsCommand, IgnoredEventType } from "../types";
import { modActionsCmd, IgnoredEventType } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage, hasPermission, sendSuccessMessage } from "../../../pluginUtils";
import { resolveUser, resolveMember } from "../../../utils";
@ -7,7 +7,7 @@ import { readContactMethodsFromArgs } from "../functions/readContactMethodsFromA
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
import { banUserId } from "../functions/banUserId";
import { ignoreEvent } from "../functions/ignoreEvent";
import { LogType } from "src/data/LogType";
import { LogType } from "../../../data/LogType";
const opts = {
mod: ct.member({ option: true }),
@ -16,7 +16,7 @@ const opts = {
"delete-days": ct.number({ option: true, shortcut: "d" }),
};
export const BanCmd = modActionsCommand({
export const BanCmd = modActionsCmd({
trigger: "ban",
permission: "can_ban",
description: "Ban the specified member",

View file

@ -1,9 +1,9 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { CasesPlugin } from "src/plugins/Cases/CasesPlugin";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
export const CaseCmd = modActionsCommand({
export const CaseCmd = modActionsCmd({
trigger: "case",
permission: "can_view",
description: "Show information about a specific case",

View file

@ -1,7 +1,7 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { trimLines, createChunkedMessage, emptyEmbedValue, sorter } from "src/utils";
import { trimLines, createChunkedMessage, emptyEmbedValue, sorter } from "../../../utils";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { asyncMap } from "../../../utils/async";
import { EmbedOptions } from "eris";
@ -13,7 +13,7 @@ const opts = {
mod: ct.member({ option: true }),
};
export const CasesModCmd = modActionsCommand({
export const CasesModCmd = modActionsCmd({
trigger: "cases",
permission: "can_view",
description: "Show the most recent 5 cases by the specified -mod",

View file

@ -1,7 +1,7 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { CasesPlugin } from "src/plugins/Cases/CasesPlugin";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import {
UnknownUser,
multiSorter,
@ -10,7 +10,7 @@ import {
resolveUser,
emptyEmbedValue,
chunkArray,
} from "src/utils";
} from "../../../utils";
import { getGuildPrefix } from "../../../utils/getGuildPrefix";
import { EmbedOptions, User } from "eris";
import { getChunkedEmbedFields } from "../../../utils/getChunkedEmbedFields";
@ -21,7 +21,7 @@ const opts = {
hidden: ct.bool({ option: true, isSwitch: true, shortcut: "h" }),
};
export const CasesUserCmd = modActionsCommand({
export const CasesUserCmd = modActionsCmd({
trigger: "cases",
permission: "can_view",
description: "Show a list of cases the specified user has",

View file

@ -1,4 +1,4 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { helpers } from "knub";
@ -10,7 +10,7 @@ import { LogType } from "../../../data/LogType";
import moment from "moment-timezone";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
export const DeleteCaseCmd = modActionsCommand({
export const DeleteCaseCmd = modActionsCmd({
trigger: ["delete_case", "deletecase"],
permission: "can_deletecase",
description: trimLines(`

View file

@ -1,4 +1,4 @@
import { modActionsCommand, IgnoredEventType } from "../types";
import { modActionsCmd, IgnoredEventType } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage, hasPermission, sendSuccessMessage } from "../../../pluginUtils";
import { resolveUser, resolveMember, stripObjectToScalars } from "../../../utils";
@ -7,15 +7,15 @@ import { readContactMethodsFromArgs } from "../functions/readContactMethodsFromA
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
import { banUserId } from "../functions/banUserId";
import { ignoreEvent } from "../functions/ignoreEvent";
import { LogType } from "src/data/LogType";
import { CaseTypes } from "src/data/CaseTypes";
import { CasesPlugin } from "src/plugins/Cases/CasesPlugin";
import { LogType } from "../../../data/LogType";
import { CaseTypes } from "../../../data/CaseTypes";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
const opts = {
mod: ct.member({ option: true }),
};
export const ForcebanCmd = modActionsCommand({
export const ForcebanCmd = modActionsCmd({
trigger: "forceban",
permission: "can_ban",
description: "Force-ban the specified user, even if they aren't on the server",

View file

@ -1,4 +1,4 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage } from "../../../pluginUtils";
import { resolveMember, resolveUser } from "../../../utils";
@ -10,7 +10,7 @@ const opts = {
"notify-channel": ct.textChannel({ option: true }),
};
export const ForcemuteCmd = modActionsCommand({
export const ForcemuteCmd = modActionsCmd({
trigger: "forcemute",
permission: "can_mute",
description: "Force-mute the specified user, even if they're not on the server",

View file

@ -1,4 +1,4 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage } from "../../../pluginUtils";
import { resolveUser, resolveMember } from "../../../utils";
@ -8,7 +8,7 @@ const opts = {
mod: ct.member({ option: true }),
};
export const ForceUnmuteCmd = modActionsCommand({
export const ForceUnmuteCmd = modActionsCmd({
trigger: "forceunmute",
permission: "can_mute",
description: "Force-unmute the specified user, even if they're not on the server",

View file

@ -1,8 +1,8 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
export const HideCaseCmd = modActionsCommand({
export const HideCaseCmd = modActionsCmd({
trigger: ["hide", "hidecase", "hide_case"],
permission: "can_hidecase",
description: "Hide the specified case so it doesn't appear in !cases or !info",

View file

@ -1,11 +1,10 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage } from "../../../pluginUtils";
import { resolveUser, resolveMember } from "../../../utils";
import { MutesPlugin } from "src/plugins/Mutes/MutesPlugin";
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin";
import { actualUnmuteCmd } from "../functions/actualUnmuteUserCmd";
import { isBanned } from "../functions/isBanned";
import { plugin } from "knub";
import { actualKickMemberCmd } from "../functions/actualKickMemberCmd";
const opts = {
@ -15,7 +14,7 @@ const opts = {
clean: ct.bool({ option: true, isSwitch: true }),
};
export const KickCmd = modActionsCommand({
export const KickCmd = modActionsCmd({
trigger: "kick",
permission: "can_kick",
description: "Kick the specified member",

View file

@ -1,4 +1,4 @@
import { modActionsCommand, IgnoredEventType } from "../types";
import { modActionsCmd, IgnoredEventType } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage, hasPermission, sendSuccessMessage } from "../../../pluginUtils";
import { resolveUser, resolveMember, stripObjectToScalars } from "../../../utils";
@ -6,14 +6,14 @@ import { isBanned } from "../functions/isBanned";
import { readContactMethodsFromArgs } from "../functions/readContactMethodsFromArgs";
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
import { banUserId } from "../functions/banUserId";
import { CaseTypes } from "src/data/CaseTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { TextChannel } from "eris";
import { waitForReply } from "knub/dist/helpers";
import { ignoreEvent } from "../functions/ignoreEvent";
import { CasesPlugin } from "src/plugins/Cases/CasesPlugin";
import { LogType } from "src/data/LogType";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { LogType } from "../../../data/LogType";
export const MassbanCmd = modActionsCommand({
export const MassbanCmd = modActionsCmd({
trigger: "massban",
permission: "can_massban",
description: "Mass-ban a list of user IDs",

View file

@ -1,15 +1,15 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { stripObjectToScalars } from "../../../utils";
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
import { TextChannel } from "eris";
import { waitForReply } from "knub/dist/helpers";
import { LogType } from "src/data/LogType";
import { logger } from "src/logger";
import { MutesPlugin } from "src/plugins/Mutes/MutesPlugin";
import { LogType } from "../../../data/LogType";
import { logger } from "../../../logger";
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin";
export const MassmuteCmd = modActionsCommand({
export const MassmuteCmd = modActionsCmd({
trigger: "massmute",
permission: "can_massmute",
description: "Mass-mute a list of user IDs",

View file

@ -1,4 +1,4 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { Case } from "../../../data/entities/Case";
import { canActOn, hasPermission, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
@ -20,7 +20,7 @@ const opts = {
"notify-channel": ct.textChannel({ option: true }),
};
export const MuteCmd = modActionsCommand({
export const MuteCmd = modActionsCmd({
trigger: "mute",
permission: "can_mute",
description: "Mute the specified member",
@ -49,7 +49,7 @@ export const MuteCmd = modActionsCommand({
if (!memberToMute) {
const _isBanned = await isBanned(pluginData, user.id);
const prefix = pluginData.guildConfig.prefix;
const prefix = pluginData.fullConfig.prefix;
if (_isBanned) {
sendErrorMessage(
pluginData,

View file

@ -1,4 +1,4 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { Case } from "../../../data/entities/Case";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
@ -8,7 +8,7 @@ import { LogType } from "../../../data/LogType";
import { CaseTypes } from "../../../data/CaseTypes";
import { resolveUser, stripObjectToScalars } from "../../../utils";
export const NoteCmd = modActionsCommand({
export const NoteCmd = modActionsCmd({
trigger: "note",
permission: "can_note",
description: "Add a note to the specified user",

View file

@ -1,4 +1,4 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { trimPluginDescription } from "../../../utils";
import { actualKickMemberCmd } from "../functions/actualKickMemberCmd";
@ -9,7 +9,7 @@ const opts = {
"notify-channel": ct.textChannel({ option: true }),
};
export const SoftbanCmd = modActionsCommand({
export const SoftbanCmd = modActionsCmd({
trigger: "softban",
permission: "can_kick",
description: trimPluginDescription(`

View file

@ -1,18 +1,18 @@
import { modActionsCommand, IgnoredEventType } from "../types";
import { modActionsCmd, IgnoredEventType } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, hasPermission, sendSuccessMessage } from "../../../pluginUtils";
import { resolveUser, stripObjectToScalars } from "../../../utils";
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
import { LogType } from "src/data/LogType";
import { LogType } from "../../../data/LogType";
import { ignoreEvent } from "../functions/ignoreEvent";
import { CaseTypes } from "src/data/CaseTypes";
import { CasesPlugin } from "src/plugins/Cases/CasesPlugin";
import { CaseTypes } from "../../../data/CaseTypes";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
const opts = {
mod: ct.member({ option: true }),
};
export const UnbanCmd = modActionsCommand({
export const UnbanCmd = modActionsCmd({
trigger: "unban",
permission: "can_ban",
description: "Unban the specified member",

View file

@ -1,8 +1,8 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
export const UnhideCaseCmd = modActionsCommand({
export const UnhideCaseCmd = modActionsCmd({
trigger: ["unhide", "unhidecase", "unhide_case"],
permission: "can_hidecase",
description: "Un-hide the specified case, making it appear in !cases and !info again",

View file

@ -1,17 +1,16 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage } from "../../../pluginUtils";
import { resolveUser, resolveMember } from "../../../utils";
import { MutesPlugin } from "src/plugins/Mutes/MutesPlugin";
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin";
import { actualUnmuteCmd } from "../functions/actualUnmuteUserCmd";
import { isBanned } from "../functions/isBanned";
import { plugin } from "knub";
const opts = {
mod: ct.member({ option: true }),
};
export const UnmuteCmd = modActionsCommand({
export const UnmuteCmd = modActionsCmd({
trigger: "unmute",
permission: "can_mute",
description: "Unmute the specified member",
@ -48,7 +47,7 @@ export const UnmuteCmd = modActionsCommand({
if (!memberToUnmute) {
const banned = await isBanned(pluginData, user.id);
const prefix = pluginData.guildConfig.prefix;
const prefix = pluginData.fullConfig.prefix;
if (banned) {
sendErrorMessage(
pluginData,

View file

@ -1,4 +1,4 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { Case } from "../../../data/entities/Case";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
@ -7,7 +7,7 @@ import { CasesPlugin } from "../../Cases/CasesPlugin";
import { LogType } from "../../../data/LogType";
import { CaseTypes } from "../../../data/CaseTypes";
export const UpdateCmd = modActionsCommand({
export const UpdateCmd = modActionsCmd({
trigger: "update",
permission: "can_note",
description:

View file

@ -1,4 +1,4 @@
import { modActionsCommand } from "../types";
import { modActionsCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { Case } from "../../../data/entities/Case";
import { canActOn, hasPermission, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
@ -13,7 +13,7 @@ import { readContactMethodsFromArgs } from "../functions/readContactMethodsFromA
import { warnMember } from "../functions/warnMember";
import { TextChannel } from "eris";
export const WarnCmd = modActionsCommand({
export const WarnCmd = modActionsCmd({
trigger: "warn",
permission: "can_warn",
description: "Send a warning to the specified user",