mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-25 10:25:01 +00:00
Revert "+debug build method (revert this)"
This reverts commit a80af1e729
.
This commit is contained in:
parent
a80af1e729
commit
139a4ab4a8
12 changed files with 23 additions and 40 deletions
9
.devcontainer/devcontainer.json
Normal file
9
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "Zeppelin Development",
|
||||
|
||||
"dockerComposeFile": "../docker-compose.development.yml",
|
||||
|
||||
"service": "devenv",
|
||||
"remoteUser": "ubuntu",
|
||||
"workspaceFolder": "/home/ubuntu/zeppelin"
|
||||
}
|
14
backend/package-lock.json
generated
14
backend/package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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));
|
||||
},
|
||||
|
|
|
@ -93,11 +93,6 @@ export function strictValidationErrorToConfigValidationError(err: StrictValidati
|
|||
|
||||
export function getPluginConfigParser(blueprint: ZeppelinPlugin, customParser?: ZeppelinPlugin["configParser"]) {
|
||||
return async (options: PluginOptions<any>, 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<any>) {
|
||||
const knub = pluginData.getKnubInstance() as TZeppelinKnub;
|
||||
// @ts-expect-error
|
||||
return knub.getGlobalConfig().url;
|
||||
}
|
||||
|
||||
export function isOwner(pluginData: AnyPluginData<any>, userId: string) {
|
||||
const knub = pluginData.getKnubInstance() as TZeppelinKnub;
|
||||
// @ts-expect-error
|
||||
const owners = knub.getGlobalConfig()?.owners;
|
||||
if (!owners) {
|
||||
return false;
|
||||
|
|
|
@ -188,7 +188,6 @@ export const AutomodPlugin = zeppelinGuildPlugin<AutomodPluginType>()({
|
|||
info: pluginInfo,
|
||||
|
||||
// prettier-ignore
|
||||
// @ts-expect-error
|
||||
dependencies: () => [
|
||||
LogsPlugin,
|
||||
ModActionsPlugin,
|
||||
|
@ -257,7 +256,7 @@ export const AutomodPlugin = zeppelinGuildPlugin<AutomodPluginType>()({
|
|||
|
||||
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<AutomodPluginType>()({
|
|||
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<AutomodPluginType>()({
|
|||
},
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ export const HelpCmd = utilityCmd({
|
|||
if (strTrigger.startsWith(searchStr)) {
|
||||
matchingCommands.push({
|
||||
plugin,
|
||||
// @ts-expect-error
|
||||
command: registeredCommand,
|
||||
});
|
||||
break;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -54,7 +54,7 @@ export function zeppelinGuildPlugin(...args) {
|
|||
const blueprint = guildPlugin(
|
||||
...(args as Parameters<typeof guildPlugin>),
|
||||
) as unknown as ZeppelinGuildPluginBlueprint;
|
||||
blueprint.configParser = <any>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<typeof globalPlugin>),
|
||||
) 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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue