3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-08 11:37:20 +00:00

refactor: convert /backend to ESM

This commit is contained in:
Dragory 2024-04-09 20:57:18 +03:00
parent 31d74c05aa
commit 5772e27cda
No known key found for this signature in database
766 changed files with 3473 additions and 3500 deletions

View file

@ -1,13 +1,13 @@
import { APIEmbed, GuildChannel } from "discord.js";
import humanizeDuration from "humanize-duration";
import LCL from "last-commit-log";
import { shuffle } from "lodash";
import shuffle from "lodash/shuffle.js";
import moment from "moment-timezone";
import { rootDir } from "../../../paths";
import { getCurrentUptime } from "../../../uptime";
import { resolveMember, sorter } from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { utilityCmd } from "../types";
import { rootDir } from "../../../paths.js";
import { getCurrentUptime } from "../../../uptime.js";
import { resolveMember, sorter } from "../../../utils.js";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js";
import { utilityCmd } from "../types.js";
export const AboutCmd = utilityCmd({
trigger: "about",

View file

@ -1,8 +1,8 @@
import { APIEmbed, ImageFormat } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { UnknownUser, renderUsername } from "../../../utils";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { UnknownUser, renderUsername } from "../../../utils.js";
import { utilityCmd } from "../types.js";
export const AvatarCmd = utilityCmd({
trigger: ["avatar", "av"],

View file

@ -1,6 +1,6 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { archiveSearch, displaySearch, SearchType } from "../search";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { archiveSearch, displaySearch, SearchType } from "../search.js";
import { utilityCmd } from "../types.js";
// Separate from BanSearchCmd to avoid a circular reference from ./search.ts
export const banSearchSignature = {

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed.js";
import { utilityCmd } from "../types.js";
export const ChannelInfoCmd = utilityCmd({
trigger: ["channel", "channelinfo"],

View file

@ -1,15 +1,15 @@
import { Message, Snowflake, TextChannel, User } from "discord.js";
import { GuildPluginData } from "knub";
import { allowTimeout } from "../../../RegExpRunner";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { LogType } from "../../../data/LogType";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { humanizeDurationShort } from "../../../humanizeDurationShort";
import { getBaseUrl, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { ModActionsPlugin } from "../../../plugins/ModActions/ModActionsPlugin";
import { DAYS, SECONDS, chunkArray, getInviteCodesInString, noop } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { UtilityPluginType, utilityCmd } from "../types";
import { allowTimeout } from "../../../RegExpRunner.js";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { LogType } from "../../../data/LogType.js";
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
import { humanizeDurationShort } from "../../../humanizeDurationShort.js";
import { getBaseUrl, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { ModActionsPlugin } from "../../../plugins/ModActions/ModActionsPlugin.js";
import { DAYS, SECONDS, chunkArray, getInviteCodesInString, noop } from "../../../utils.js";
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
import { UtilityPluginType, utilityCmd } from "../types.js";
const MAX_CLEAN_COUNT = 300;
const MAX_CLEAN_TIME = 1 * DAYS;

View file

@ -1,9 +1,9 @@
import { Snowflake, TextChannel } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { messageLink } from "../../../utils";
import { canReadChannel } from "../../../utils/canReadChannel";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { messageLink } from "../../../utils.js";
import { canReadChannel } from "../../../utils/canReadChannel.js";
import { utilityCmd } from "../types.js";
export const ContextCmd = utilityCmd({
trigger: "context",

View file

@ -1,8 +1,8 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { getCustomEmojiId } from "../functions/getCustomEmojiId";
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { getCustomEmojiId } from "../functions/getCustomEmojiId.js";
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed.js";
import { utilityCmd } from "../types.js";
export const EmojiInfoCmd = utilityCmd({
trigger: ["emoji", "emojiinfo"],

View file

@ -1,7 +1,7 @@
import { LoadedGuildPlugin, PluginCommandDefinition } from "knub";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { createChunkedMessage } from "../../../utils";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { createChunkedMessage } from "../../../utils.js";
import { utilityCmd } from "../types.js";
export const HelpCmd = utilityCmd({
trigger: "help",

View file

@ -1,21 +1,21 @@
import { Snowflake } from "discord.js";
import { getChannelId, getRoleId } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { isValidSnowflake, noop, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils";
import { canReadChannel } from "../../../utils/canReadChannel";
import { resolveMessageTarget } from "../../../utils/resolveMessageTarget";
import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed";
import { getCustomEmojiId } from "../functions/getCustomEmojiId";
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed";
import { getGuildPreview } from "../functions/getGuildPreview";
import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed";
import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed";
import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed";
import { getServerInfoEmbed } from "../functions/getServerInfoEmbed";
import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed";
import { getUserInfoEmbed } from "../functions/getUserInfoEmbed";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { isValidSnowflake, noop, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils.js";
import { canReadChannel } from "../../../utils/canReadChannel.js";
import { resolveMessageTarget } from "../../../utils/resolveMessageTarget.js";
import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed.js";
import { getCustomEmojiId } from "../functions/getCustomEmojiId.js";
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed.js";
import { getGuildPreview } from "../functions/getGuildPreview.js";
import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed.js";
import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed.js";
import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed.js";
import { getServerInfoEmbed } from "../functions/getServerInfoEmbed.js";
import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed.js";
import { getUserInfoEmbed } from "../functions/getUserInfoEmbed.js";
import { utilityCmd } from "../types.js";
export const InfoCmd = utilityCmd({
trigger: "info",

View file

@ -1,8 +1,8 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { parseInviteCodeInput } from "../../../utils";
import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { parseInviteCodeInput } from "../../../utils.js";
import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed.js";
import { utilityCmd } from "../types.js";
export const InviteInfoCmd = utilityCmd({
trigger: ["invite", "inviteinfo"],

View file

@ -2,10 +2,10 @@ import photon from "@silvia-odwyer/photon-node";
import { AttachmentBuilder } from "discord.js";
import fs from "fs";
import twemoji from "twemoji";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { downloadFile, isEmoji, SECONDS } from "../../../utils";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { downloadFile, isEmoji, SECONDS } from "../../../utils.js";
import { utilityCmd } from "../types.js";
const fsp = fs.promises;

View file

@ -1,7 +1,7 @@
import { helpers } from "knub";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { renderUsername } from "../../../utils";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { renderUsername } from "../../../utils.js";
import { utilityCmd } from "../types.js";
const { getMemberLevel } = helpers;

View file

@ -1,8 +1,8 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { canReadChannel } from "../../../utils/canReadChannel";
import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { canReadChannel } from "../../../utils/canReadChannel.js";
import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed.js";
import { utilityCmd } from "../types.js";
export const MessageInfoCmd = utilityCmd({
trigger: ["message", "messageinfo"],

View file

@ -1,8 +1,8 @@
import { escapeBold } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendSuccessMessage } from "../../../pluginUtils";
import { errorMessage } from "../../../utils";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { canActOn, sendSuccessMessage } from "../../../pluginUtils.js";
import { errorMessage } from "../../../utils.js";
import { utilityCmd } from "../types.js";
export const NicknameCmd = utilityCmd({
trigger: ["nickname", "nick"],

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendSuccessMessage } from "../../../pluginUtils";
import { errorMessage } from "../../../utils";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { canActOn, sendSuccessMessage } from "../../../pluginUtils.js";
import { errorMessage } from "../../../utils.js";
import { utilityCmd } from "../types.js";
export const NicknameResetCmd = utilityCmd({
trigger: ["nickname reset", "nick reset"],

View file

@ -1,7 +1,7 @@
import { Message } from "discord.js";
import { performance } from "perf_hooks";
import { noop, trimLines } from "../../../utils";
import { utilityCmd } from "../types";
import { noop, trimLines } from "../../../utils.js";
import { utilityCmd } from "../types.js";
export const PingCmd = utilityCmd({
trigger: ["ping", "pong"],

View file

@ -1,6 +1,6 @@
import { TextChannel } from "discord.js";
import { activeReloads } from "../guildReloads";
import { utilityCmd } from "../types";
import { activeReloads } from "../guildReloads.js";
import { utilityCmd } from "../types.js";
export const ReloadGuildCmd = utilityCmd({
trigger: "reload_guild",

View file

@ -1,6 +1,6 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed.js";
import { utilityCmd } from "../types.js";
export const RoleInfoCmd = utilityCmd({
trigger: ["roleinfo"],

View file

@ -1,9 +1,9 @@
import { Role } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { chunkArray, sorter, trimLines } from "../../../utils";
import { refreshMembersIfNeeded } from "../refreshMembers";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { chunkArray, sorter, trimLines } from "../../../utils.js";
import { refreshMembersIfNeeded } from "../refreshMembers.js";
import { utilityCmd } from "../types.js";
export const RolesCmd = utilityCmd({
trigger: "roles",

View file

@ -1,6 +1,6 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { archiveSearch, displaySearch, SearchType } from "../search";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { archiveSearch, displaySearch, SearchType } from "../search.js";
import { utilityCmd } from "../types.js";
// Separate from SearchCmd to avoid a circular reference from ./search.ts
export const searchCmdSignature = {

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { getServerInfoEmbed } from "../functions/getServerInfoEmbed";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { getServerInfoEmbed } from "../functions/getServerInfoEmbed.js";
import { utilityCmd } from "../types.js";
export const ServerInfoCmd = utilityCmd({
trigger: ["server", "serverinfo"],

View file

@ -1,6 +1,6 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed.js";
import { utilityCmd } from "../types.js";
export const SnowflakeInfoCmd = utilityCmd({
trigger: ["snowflake", "snowflakeinfo"],

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { getBaseUrl, sendErrorMessage } from "../../../pluginUtils";
import { canReadChannel } from "../../../utils/canReadChannel";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { getBaseUrl, sendErrorMessage } from "../../../pluginUtils.js";
import { canReadChannel } from "../../../utils/canReadChannel.js";
import { utilityCmd } from "../types.js";
export const SourceCmd = utilityCmd({
trigger: "source",

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { getUserInfoEmbed } from "../functions/getUserInfoEmbed";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { getUserInfoEmbed } from "../functions/getUserInfoEmbed.js";
import { utilityCmd } from "../types.js";
export const UserInfoCmd = utilityCmd({
trigger: ["user", "userinfo", "whois"],

View file

@ -1,9 +1,9 @@
import { VoiceChannel } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { renderUsername } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { renderUsername } from "../../../utils.js";
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
import { utilityCmd } from "../types.js";
export const VcdisconnectCmd = utilityCmd({
trigger: ["vcdisconnect", "vcdisc", "vcdc", "vckick", "vck"],

View file

@ -1,9 +1,9 @@
import { ChannelType, Snowflake, VoiceChannel } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { channelMentionRegex, isSnowflake, renderUsername, simpleClosestStringMatch } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { channelMentionRegex, isSnowflake, renderUsername, simpleClosestStringMatch } from "../../../utils.js";
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
import { utilityCmd } from "../types.js";
export const VcmoveCmd = utilityCmd({
trigger: "vcmove",