3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 11:07:19 +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,28 +1,28 @@
import { Snowflake, TextChannel } from "discord.js";
import { globalPlugin } from "knub";
import { AllowedGuilds } from "../../data/AllowedGuilds";
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
import { Configs } from "../../data/Configs";
import { GuildArchives } from "../../data/GuildArchives";
import { sendSuccessMessage } from "../../pluginUtils";
import { getActiveReload, resetActiveReload } from "./activeReload";
import { AddDashboardUserCmd } from "./commands/AddDashboardUserCmd";
import { AddServerFromInviteCmd } from "./commands/AddServerFromInviteCmd";
import { AllowServerCmd } from "./commands/AllowServerCmd";
import { ChannelToServerCmd } from "./commands/ChannelToServerCmd";
import { DisallowServerCmd } from "./commands/DisallowServerCmd";
import { EligibleCmd } from "./commands/EligibleCmd";
import { LeaveServerCmd } from "./commands/LeaveServerCmd";
import { ListDashboardPermsCmd } from "./commands/ListDashboardPermsCmd";
import { ListDashboardUsersCmd } from "./commands/ListDashboardUsersCmd";
import { ProfilerDataCmd } from "./commands/ProfilerDataCmd";
import { RateLimitPerformanceCmd } from "./commands/RateLimitPerformanceCmd";
import { ReloadGlobalPluginsCmd } from "./commands/ReloadGlobalPluginsCmd";
import { ReloadServerCmd } from "./commands/ReloadServerCmd";
import { RemoveDashboardUserCmd } from "./commands/RemoveDashboardUserCmd";
import { RestPerformanceCmd } from "./commands/RestPerformanceCmd";
import { ServersCmd } from "./commands/ServersCmd";
import { BotControlPluginType, zBotControlConfig } from "./types";
import { AllowedGuilds } from "../../data/AllowedGuilds.js";
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments.js";
import { Configs } from "../../data/Configs.js";
import { GuildArchives } from "../../data/GuildArchives.js";
import { sendSuccessMessage } from "../../pluginUtils.js";
import { getActiveReload, resetActiveReload } from "./activeReload.js";
import { AddDashboardUserCmd } from "./commands/AddDashboardUserCmd.js";
import { AddServerFromInviteCmd } from "./commands/AddServerFromInviteCmd.js";
import { AllowServerCmd } from "./commands/AllowServerCmd.js";
import { ChannelToServerCmd } from "./commands/ChannelToServerCmd.js";
import { DisallowServerCmd } from "./commands/DisallowServerCmd.js";
import { EligibleCmd } from "./commands/EligibleCmd.js";
import { LeaveServerCmd } from "./commands/LeaveServerCmd.js";
import { ListDashboardPermsCmd } from "./commands/ListDashboardPermsCmd.js";
import { ListDashboardUsersCmd } from "./commands/ListDashboardUsersCmd.js";
import { ProfilerDataCmd } from "./commands/ProfilerDataCmd.js";
import { RateLimitPerformanceCmd } from "./commands/RateLimitPerformanceCmd.js";
import { ReloadGlobalPluginsCmd } from "./commands/ReloadGlobalPluginsCmd.js";
import { ReloadServerCmd } from "./commands/ReloadServerCmd.js";
import { RemoveDashboardUserCmd } from "./commands/RemoveDashboardUserCmd.js";
import { RestPerformanceCmd } from "./commands/RestPerformanceCmd.js";
import { ServersCmd } from "./commands/ServersCmd.js";
import { BotControlPluginType, zBotControlConfig } from "./types.js";
const defaultOptions = {
config: {

View file

@ -1,8 +1,8 @@
import { ApiPermissions } from "@zeppelinbot/shared";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { renderUsername } from "../../../utils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { renderUsername } from "../../../utils.js";
import { botControlCmd } from "../types.js";
export const AddDashboardUserCmd = botControlCmd({
trigger: ["add_dashboard_user"],

View file

@ -1,10 +1,10 @@
import { ApiPermissions } from "@zeppelinbot/shared";
import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { DBDateFormat, isGuildInvite, resolveInvite } from "../../../utils";
import { isEligible } from "../functions/isEligible";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { DBDateFormat, isGuildInvite, resolveInvite } from "../../../utils.js";
import { isEligible } from "../functions/isEligible.js";
import { botControlCmd } from "../types.js";
export const AddServerFromInviteCmd = botControlCmd({
trigger: ["add_server_from_invite", "allow_server_from_invite", "adv"],

View file

@ -1,9 +1,9 @@
import { ApiPermissions } from "@zeppelinbot/shared";
import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { DBDateFormat, isSnowflake } from "../../../utils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { DBDateFormat, isSnowflake } from "../../../utils.js";
import { botControlCmd } from "../types.js";
export const AllowServerCmd = botControlCmd({
trigger: ["allow_server", "allowserver", "add_server", "addserver"],

View file

@ -1,6 +1,6 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter, sendErrorMessage } from "../../../pluginUtils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { isStaffPreFilter, sendErrorMessage } from "../../../pluginUtils.js";
import { botControlCmd } from "../types.js";
export const ChannelToServerCmd = botControlCmd({
trigger: ["channel_to_server", "channel2server"],

View file

@ -1,8 +1,8 @@
import { Snowflake } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { noop } from "../../../utils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { noop } from "../../../utils.js";
import { botControlCmd } from "../types.js";
export const DisallowServerCmd = botControlCmd({
trigger: ["disallow_server", "disallowserver", "remove_server", "removeserver"],

View file

@ -1,8 +1,8 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { isGuildInvite, resolveInvite } from "../../../utils";
import { isEligible } from "../functions/isEligible";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { isGuildInvite, resolveInvite } from "../../../utils.js";
import { isEligible } from "../functions/isEligible.js";
import { botControlCmd } from "../types.js";
export const EligibleCmd = botControlCmd({
trigger: ["eligible", "is_eligible", "iseligible"],

View file

@ -1,7 +1,7 @@
import { Snowflake } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { botControlCmd } from "../types.js";
export const LeaveServerCmd = botControlCmd({
trigger: ["leave_server", "leave_guild"],

View file

@ -1,9 +1,9 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { AllowedGuild } from "../../../data/entities/AllowedGuild";
import { ApiPermissionAssignment } from "../../../data/entities/ApiPermissionAssignment";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { renderUsername, resolveUser } from "../../../utils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { AllowedGuild } from "../../../data/entities/AllowedGuild.js";
import { ApiPermissionAssignment } from "../../../data/entities/ApiPermissionAssignment.js";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { renderUsername, resolveUser } from "../../../utils.js";
import { botControlCmd } from "../types.js";
export const ListDashboardPermsCmd = botControlCmd({
trigger: ["list_dashboard_permissions", "list_dashboard_perms", "list_dash_permissions", "list_dash_perms"],

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { renderUsername, resolveUser } from "../../../utils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { renderUsername, resolveUser } from "../../../utils.js";
import { botControlCmd } from "../types.js";
export const ListDashboardUsersCmd = botControlCmd({
trigger: ["list_dashboard_users"],

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { GuildArchives } from "../../../data/GuildArchives";
import { getBaseUrl } from "../../../pluginUtils";
import { sorter } from "../../../utils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { GuildArchives } from "../../../data/GuildArchives.js";
import { getBaseUrl } from "../../../pluginUtils.js";
import { sorter } from "../../../utils.js";
import { botControlCmd } from "../types.js";
const sortProps = {
totalTime: "TOTAL TIME",

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { GuildArchives } from "../../../data/GuildArchives";
import { getBaseUrl, sendSuccessMessage } from "../../../pluginUtils";
import { getRateLimitStats } from "../../../rateLimitStats";
import { botControlCmd } from "../types";
import { GuildArchives } from "../../../data/GuildArchives.js";
import { getBaseUrl, sendSuccessMessage } from "../../../pluginUtils.js";
import { getRateLimitStats } from "../../../rateLimitStats.js";
import { botControlCmd } from "../types.js";
export const RateLimitPerformanceCmd = botControlCmd({
trigger: ["rate_limit_performance"],

View file

@ -1,6 +1,6 @@
import { isStaffPreFilter, sendErrorMessage } from "../../../pluginUtils";
import { getActiveReload, setActiveReload } from "../activeReload";
import { botControlCmd } from "../types";
import { isStaffPreFilter, sendErrorMessage } from "../../../pluginUtils.js";
import { getActiveReload, setActiveReload } from "../activeReload.js";
import { botControlCmd } from "../types.js";
export const ReloadGlobalPluginsCmd = botControlCmd({
trigger: "bot_reload_global_plugins",

View file

@ -1,7 +1,7 @@
import { Snowflake } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { botControlCmd } from "../types.js";
export const ReloadServerCmd = botControlCmd({
trigger: ["reload_server", "reload_guild"],

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { renderUsername } from "../../../utils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
import { renderUsername } from "../../../utils.js";
import { botControlCmd } from "../types.js";
export const RemoveDashboardUserCmd = botControlCmd({
trigger: ["remove_dashboard_user"],

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { getTopRestCallStats } from "../../../restCallStats";
import { createChunkedMessage } from "../../../utils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { getTopRestCallStats } from "../../../restCallStats.js";
import { createChunkedMessage } from "../../../utils.js";
import { botControlCmd } from "../types.js";
const leadingPathRegex = /(?<=\().+\/backend\//g;

View file

@ -1,8 +1,8 @@
import escapeStringRegexp from "escape-string-regexp";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter } from "../../../pluginUtils";
import { createChunkedMessage, getUser, renderUsername, sorter } from "../../../utils";
import { botControlCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { isStaffPreFilter } from "../../../pluginUtils.js";
import { createChunkedMessage, getUser, renderUsername, sorter } from "../../../utils.js";
import { botControlCmd } from "../types.js";
export const ServersCmd = botControlCmd({
trigger: ["servers", "guilds"],

View file

@ -1,7 +1,7 @@
import { User } from "discord.js";
import { GlobalPluginData } from "knub";
import { GuildInvite } from "../../../utils";
import { BotControlPluginType } from "../types";
import { GuildInvite } from "../../../utils.js";
import { BotControlPluginType } from "../types.js";
const REQUIRED_MEMBER_COUNT = 5000;

View file

@ -1,10 +1,10 @@
import { BasePluginType, globalPluginEventListener, globalPluginMessageCommand } from "knub";
import z from "zod";
import { AllowedGuilds } from "../../data/AllowedGuilds";
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
import { Configs } from "../../data/Configs";
import { GuildArchives } from "../../data/GuildArchives";
import { zBoundedCharacters } from "../../utils";
import { AllowedGuilds } from "../../data/AllowedGuilds.js";
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments.js";
import { Configs } from "../../data/Configs.js";
import { GuildArchives } from "../../data/GuildArchives.js";
import { zBoundedCharacters } from "../../utils.js";
export const zBotControlConfig = z.strictObject({
can_use: z.boolean(),