diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..0d15eb29 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,9 @@ +{ + "name": "Zeppelin Development", + + "dockerComposeFile": "../docker-compose.development.yml", + + "service": "devenv", + "remoteUser": "ubuntu", + "workspaceFolder": "/home/ubuntu/zeppelin" +} diff --git a/backend/package-lock.json b/backend/package-lock.json index 1bdf9bd9..5638ff04 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -23,7 +23,7 @@ "humanize-duration": "^3.15.0", "io-ts": "^2.0.0", "js-yaml": "^3.13.1", - "knub": "^31.0.0", + "knub": "^32.0.0-next.0", "knub-command-manager": "^9.1.0", "last-commit-log": "^2.1.0", "lodash.chunk": "^4.2.0", @@ -2704,9 +2704,9 @@ } }, "node_modules/knub": { - "version": "31.0.0", - "resolved": "https://registry.npmjs.org/knub/-/knub-31.0.0.tgz", - "integrity": "sha512-mm2PrtQ9G5UoELfJ4kjWaNQZZRMhwJbCf4FgJj92iDy4pg95XPNWAkwTw8avbkslNjb9m5Va1pp3IeJayvz/ag==", + "version": "32.0.0-next.0", + "resolved": "https://registry.npmjs.org/knub/-/knub-32.0.0-next.0.tgz", + "integrity": "sha512-tT27Qr8qpge+EWonrMyw54mZ67/1WP3oKF7QgTdK6cYArTdERuYxF9X7ngd9JXcVeW9/WYz/62jq42/w9lDzIA==", "dependencies": { "discord-api-types": "^0.37.10", "discord.js": "^14", @@ -7199,9 +7199,9 @@ } }, "knub": { - "version": "31.0.0", - "resolved": "https://registry.npmjs.org/knub/-/knub-31.0.0.tgz", - "integrity": "sha512-mm2PrtQ9G5UoELfJ4kjWaNQZZRMhwJbCf4FgJj92iDy4pg95XPNWAkwTw8avbkslNjb9m5Va1pp3IeJayvz/ag==", + "version": "32.0.0-next.0", + "resolved": "https://registry.npmjs.org/knub/-/knub-32.0.0-next.0.tgz", + "integrity": "sha512-tT27Qr8qpge+EWonrMyw54mZ67/1WP3oKF7QgTdK6cYArTdERuYxF9X7ngd9JXcVeW9/WYz/62jq42/w9lDzIA==", "requires": { "discord-api-types": "^0.37.10", "discord.js": "^14", diff --git a/backend/package.json b/backend/package.json index d14c8da7..95b0a52b 100644 --- a/backend/package.json +++ b/backend/package.json @@ -38,7 +38,7 @@ "humanize-duration": "^3.15.0", "io-ts": "^2.0.0", "js-yaml": "^3.13.1", - "knub": "^31.0.0", + "knub": "^32.0.0-next.0", "knub-command-manager": "^9.1.0", "last-commit-log": "^2.1.0", "lodash.chunk": "^4.2.0", diff --git a/backend/src/index.ts b/backend/src/index.ts index f01003cf..e93e17df 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -354,7 +354,6 @@ connect().then(async () => { sendSuccessMessageFn(channel, body) { const guildId = channel instanceof TextChannel || channel instanceof ThreadChannel ? channel.guild.id : undefined; - // @ts-expect-error const emoji = guildId ? bot.getLoadedGuild(guildId)!.config.success_emoji : undefined; channel.send(successMessage(body, emoji)); }, @@ -362,7 +361,6 @@ connect().then(async () => { sendErrorMessageFn(channel, body) { const guildId = channel instanceof TextChannel || channel instanceof ThreadChannel ? channel.guild.id : undefined; - // @ts-expect-error const emoji = guildId ? bot.getLoadedGuild(guildId)!.config.error_emoji : undefined; channel.send(errorMessage(body, emoji)); }, diff --git a/backend/src/pluginUtils.ts b/backend/src/pluginUtils.ts index 4c110914..e654f630 100644 --- a/backend/src/pluginUtils.ts +++ b/backend/src/pluginUtils.ts @@ -93,11 +93,6 @@ export function strictValidationErrorToConfigValidationError(err: StrictValidati export function getPluginConfigParser(blueprint: ZeppelinPlugin, customParser?: ZeppelinPlugin["configParser"]) { return async (options: PluginOptions, strict?: boolean) => { - const ident = `[getPluginConfigParser.${blueprint.name}] | `; - if (blueprint.name === "mutes") { - console.log(ident, "options => ", JSON.stringify(options)); - } - // 1. Validate the basic structure of plugin config const basicOptionsValidation = validate(BasicPluginStructureType, options); if (basicOptionsValidation instanceof StrictValidationError) { @@ -147,7 +142,7 @@ export function getPluginConfigParser(blueprint: ZeppelinPlugin, customParser?: } } - // 3. Run custom parser, if any + // 3. Run custom preprocessor, if any if (customParser) { options = await customParser(options); } @@ -161,7 +156,6 @@ export function getPluginConfigParser(blueprint: ZeppelinPlugin, customParser?: ? decodeAndValidateStrict(blueprint.configSchema, options.config) : options.config; if (decodedConfig instanceof StrictValidationError) { - console.error("4.strict:", blueprint.name); throw strictValidationErrorToConfigValidationError(decodedConfig); } } @@ -173,7 +167,6 @@ export function getPluginConfigParser(blueprint: ZeppelinPlugin, customParser?: ? decodeAndValidateStrict(blueprint.configSchema, overrideConfigMergedWithBaseConfig) : overrideConfigMergedWithBaseConfig; if (decodedOverrideConfig instanceof StrictValidationError) { - console.error("4.overrides.strict:", blueprint.name, options, decodedOverrideConfig); throw strictValidationErrorToConfigValidationError(decodedOverrideConfig); } decodedOverrides.push({ @@ -234,13 +227,11 @@ export async function sendErrorMessage( export function getBaseUrl(pluginData: AnyPluginData) { const knub = pluginData.getKnubInstance() as TZeppelinKnub; - // @ts-expect-error return knub.getGlobalConfig().url; } export function isOwner(pluginData: AnyPluginData, userId: string) { const knub = pluginData.getKnubInstance() as TZeppelinKnub; - // @ts-expect-error const owners = knub.getGlobalConfig()?.owners; if (!owners) { return false; diff --git a/backend/src/plugins/Automod/AutomodPlugin.ts b/backend/src/plugins/Automod/AutomodPlugin.ts index 3fe5d0c1..15a5c7b4 100644 --- a/backend/src/plugins/Automod/AutomodPlugin.ts +++ b/backend/src/plugins/Automod/AutomodPlugin.ts @@ -188,7 +188,6 @@ export const AutomodPlugin = zeppelinGuildPlugin()({ info: pluginInfo, // prettier-ignore - // @ts-expect-error dependencies: () => [ LogsPlugin, ModActionsPlugin, @@ -257,7 +256,7 @@ export const AutomodPlugin = zeppelinGuildPlugin()({ pluginData.state.onMessageUpdateFn = (message) => runAutomodOnMessage(pluginData, message, true); pluginData.state.savedMessages.events.on("update", pluginData.state.onMessageUpdateFn); - // @ts-expect-error + const countersPlugin = pluginData.getPlugin(CountersPlugin); pluginData.state.onCounterTrigger = (name, triggerName, channelId, userId) => { @@ -267,9 +266,8 @@ export const AutomodPlugin = zeppelinGuildPlugin()({ pluginData.state.onCounterReverseTrigger = (name, triggerName, channelId, userId) => { runAutomodOnCounterTrigger(pluginData, name, triggerName, channelId, userId, true); }; - // @ts-expect-error + countersPlugin.onCounterEvent("trigger", pluginData.state.onCounterTrigger); - // @ts-expect-error countersPlugin.onCounterEvent("reverseTrigger", pluginData.state.onCounterReverseTrigger); const modActionsEvents = pluginData.getPlugin(ModActionsPlugin).getEventEmitter(); @@ -311,14 +309,11 @@ export const AutomodPlugin = zeppelinGuildPlugin()({ }, async beforeUnload(pluginData) { - // @ts-expect-error const countersPlugin = pluginData.getPlugin(CountersPlugin); if (pluginData.state.onCounterTrigger) { - // @ts-expect-error countersPlugin.offCounterEvent("trigger", pluginData.state.onCounterTrigger); } if (pluginData.state.onCounterReverseTrigger) { - // @ts-expect-error countersPlugin.offCounterEvent("reverseTrigger", pluginData.state.onCounterReverseTrigger); } diff --git a/backend/src/plugins/Automod/actions/addToCounter.ts b/backend/src/plugins/Automod/actions/addToCounter.ts index d1876fb0..7e7f4ac8 100644 --- a/backend/src/plugins/Automod/actions/addToCounter.ts +++ b/backend/src/plugins/Automod/actions/addToCounter.ts @@ -12,9 +12,7 @@ export const AddToCounterAction = automodAction({ defaultConfig: {}, async apply({ pluginData, contexts, actionConfig, matchResult, ruleName }) { - // @ts-expect-error const countersPlugin = pluginData.getPlugin(CountersPlugin); - // @ts-expect-error if (!countersPlugin.counterExists(actionConfig.counter)) { pluginData.getPlugin(LogsPlugin).logBotAlert({ body: `Unknown counter \`${actionConfig.counter}\` in \`add_to_counter\` action of Automod rule \`${ruleName}\``, @@ -22,7 +20,6 @@ export const AddToCounterAction = automodAction({ return; } - // @ts-expect-error countersPlugin.changeCounterValue( actionConfig.counter, contexts[0].message?.channel_id || null, diff --git a/backend/src/plugins/Automod/actions/setCounter.ts b/backend/src/plugins/Automod/actions/setCounter.ts index 00897ef8..5206e579 100644 --- a/backend/src/plugins/Automod/actions/setCounter.ts +++ b/backend/src/plugins/Automod/actions/setCounter.ts @@ -12,9 +12,7 @@ export const SetCounterAction = automodAction({ defaultConfig: {}, async apply({ pluginData, contexts, actionConfig, matchResult, ruleName }) { - // @ts-expect-error const countersPlugin = pluginData.getPlugin(CountersPlugin); - // @ts-expect-error if (!countersPlugin.counterExists(actionConfig.counter)) { pluginData.getPlugin(LogsPlugin).logBotAlert({ body: `Unknown counter \`${actionConfig.counter}\` in \`add_to_counter\` action of Automod rule \`${ruleName}\``, @@ -22,7 +20,6 @@ export const SetCounterAction = automodAction({ return; } - // @ts-expect-error countersPlugin.setCounterValue( actionConfig.counter, contexts[0].message?.channel_id || null, diff --git a/backend/src/plugins/Automod/events/runAutomodOnCounterTrigger.ts b/backend/src/plugins/Automod/events/runAutomodOnCounterTrigger.ts index 125e3854..01f75116 100644 --- a/backend/src/plugins/Automod/events/runAutomodOnCounterTrigger.ts +++ b/backend/src/plugins/Automod/events/runAutomodOnCounterTrigger.ts @@ -14,11 +14,9 @@ export async function runAutomodOnCounterTrigger( ) { const user = userId ? await resolveUser(pluginData.client, userId) : undefined; const member = (userId && (await resolveMember(pluginData.client, pluginData.guild, userId))) || undefined; - // @ts-expect-error + const prettyCounterName = pluginData.getPlugin(CountersPlugin).getPrettyNameForCounter(counterName); - // @ts-expect-error const prettyTriggerName = pluginData - // @ts-expect-error .getPlugin(CountersPlugin) .getPrettyNameForCounterTrigger(counterName, triggerName); diff --git a/backend/src/plugins/Utility/commands/HelpCmd.ts b/backend/src/plugins/Utility/commands/HelpCmd.ts index d4b0e859..5094dcc8 100644 --- a/backend/src/plugins/Utility/commands/HelpCmd.ts +++ b/backend/src/plugins/Utility/commands/HelpCmd.ts @@ -32,7 +32,6 @@ export const HelpCmd = utilityCmd({ if (strTrigger.startsWith(searchStr)) { matchingCommands.push({ plugin, - // @ts-expect-error command: registeredCommand, }); break; diff --git a/backend/src/plugins/Utility/functions/getMessageInfoEmbed.ts b/backend/src/plugins/Utility/functions/getMessageInfoEmbed.ts index 3f15e87f..056aae2c 100644 --- a/backend/src/plugins/Utility/functions/getMessageInfoEmbed.ts +++ b/backend/src/plugins/Utility/functions/getMessageInfoEmbed.ts @@ -136,7 +136,6 @@ export async function getMessageInfoEmbed( } if (message.embeds.length) { - // @ts-expect-error const prefix = pluginData.fullConfig.prefix || getDefaultPrefix(pluginData.client); embed.fields.push({ name: preEmbedPadding + "Embeds", diff --git a/backend/src/plugins/ZeppelinPluginBlueprint.ts b/backend/src/plugins/ZeppelinPluginBlueprint.ts index 783d327d..acfe6d40 100644 --- a/backend/src/plugins/ZeppelinPluginBlueprint.ts +++ b/backend/src/plugins/ZeppelinPluginBlueprint.ts @@ -54,7 +54,7 @@ export function zeppelinGuildPlugin(...args) { const blueprint = guildPlugin( ...(args as Parameters), ) as unknown as ZeppelinGuildPluginBlueprint; - blueprint.configParser = getPluginConfigParser(blueprint, blueprint.configParser); + blueprint.configParser = getPluginConfigParser(blueprint, blueprint.configParser); return blueprint; } else { return zeppelinGuildPlugin as (name, blueprint) => ZeppelinGuildPluginBlueprint; @@ -89,7 +89,7 @@ export function zeppelinGlobalPlugin(...args) { const blueprint = globalPlugin( ...(args as Parameters), ) as unknown as ZeppelinGlobalPluginBlueprint; - // @ts-expect-error FIXME: Check the types here + // @ts-ignore FIXME: Check the types here blueprint.configParser = getPluginConfigParser(blueprint, blueprint.configParser); return blueprint; } else {