3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-21 16:55:03 +00:00

Merge remote-tracking branch 'upstream/master' into feat/mime-checking

This commit is contained in:
Hiroyuki 2021-08-14 13:52:08 -04:00
commit 64df1909e7
No known key found for this signature in database
GPG key ID: 843DF434003F6710
76 changed files with 18894 additions and 4637 deletions

View file

@ -8,7 +8,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [14.x] node-version: [16.6]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1

2
.nvmrc
View file

@ -1 +1 @@
14 16.6

View file

@ -65,6 +65,8 @@ These instructions are intended for bot development only.
Configuration is stored in the database in the `configs` table Configuration is stored in the database in the `configs` table
```yml ```yml
prefix: '!'
# role id: level # role id: level
levels: levels:
"12345678": 100 # Example admin "12345678": 100 # Example admin

1370
backend/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -23,23 +23,23 @@
"test-watch": "tsc-watch --onSuccess \"npx ava\"" "test-watch": "tsc-watch --onSuccess \"npx ava\""
}, },
"dependencies": { "dependencies": {
"@types/sharp": "^0.23.1", "@silvia-odwyer/photon-node": "^0.3.1",
"@types/twemoji": "^12.1.0",
"bufferutil": "^4.0.3", "bufferutil": "^4.0.3",
"cors": "^2.8.5", "cors": "^2.8.5",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"deep-diff": "^1.0.2", "deep-diff": "^1.0.2",
"discord.js": "^13.0.0-dev.d310e4f.1627560163", "discord-api-types": "^0.22.0",
"discord.js": "^13.1.0",
"dotenv": "^4.0.0", "dotenv": "^4.0.0",
"emoji-regex": "^8.0.0", "emoji-regex": "^8.0.0",
"erlpack": "github:discord/erlpack", "erlpack": "github:almeidx/erlpack#f0c535f73817fd914806d6ca26a7730c14e0fb7c",
"escape-string-regexp": "^1.0.5", "escape-string-regexp": "^1.0.5",
"express": "^4.17.0", "express": "^4.17.0",
"fp-ts": "^2.0.1", "fp-ts": "^2.0.1",
"humanize-duration": "^3.15.0", "humanize-duration": "^3.15.0",
"io-ts": "^2.0.0", "io-ts": "^2.0.0",
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"knub": "file:../../Knub", "knub": "^30.0.0-beta.39",
"knub-command-manager": "^9.1.0", "knub-command-manager": "^9.1.0",
"last-commit-log": "^2.1.0", "last-commit-log": "^2.1.0",
"lodash.chunk": "^4.2.0", "lodash.chunk": "^4.2.0",
@ -59,9 +59,8 @@
"regexp-worker": "^1.1.0", "regexp-worker": "^1.1.0",
"safe-regex": "^2.0.2", "safe-regex": "^2.0.2",
"seedrandom": "^3.0.1", "seedrandom": "^3.0.1",
"sharp": "^0.23.4",
"strip-combining-marks": "^1.0.0", "strip-combining-marks": "^1.0.0",
"tlds": "^1.203.1", "tlds": "^1.221.1",
"tmp": "0.0.33", "tmp": "0.0.33",
"tsconfig-paths": "^3.9.0", "tsconfig-paths": "^3.9.0",
"twemoji": "^12.1.4", "twemoji": "^12.1.4",
@ -84,6 +83,7 @@
"@types/passport-strategy": "^0.2.35", "@types/passport-strategy": "^0.2.35",
"@types/safe-regex": "^1.1.2", "@types/safe-regex": "^1.1.2",
"@types/tmp": "0.0.33", "@types/tmp": "0.0.33",
"@types/twemoji": "^12.1.0",
"ava": "^3.10.0", "ava": "^3.10.0",
"rimraf": "^2.6.2", "rimraf": "^2.6.2",
"source-map-support": "^0.5.16", "source-map-support": "^0.5.16",

View file

@ -37,7 +37,7 @@ export function initDocs(app: express.Express) {
app.get("/docs/plugins", (req: express.Request, res: express.Response) => { app.get("/docs/plugins", (req: express.Request, res: express.Response) => {
res.json( res.json(
docsPlugins.map(plugin => { docsPlugins.map(plugin => {
const thinInfo = plugin.info ? { prettyName: plugin.info.prettyName } : {}; const thinInfo = plugin.info ? { prettyName: plugin.info.prettyName, legacy: plugin.info.legacy ?? false } : {};
return { return {
name: plugin.name, name: plugin.name,
info: thinInfo, info: thinInfo,

View file

@ -0,0 +1,35 @@
import { DeleteResult, getRepository, InsertResult, Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { ContextMenuLink } from "./entities/ContextMenuLink";
export class GuildContextMenuLinks extends BaseGuildRepository {
private contextLinks: Repository<ContextMenuLink>;
constructor(guildId) {
super(guildId);
this.contextLinks = getRepository(ContextMenuLink);
}
async get(id: string): Promise<ContextMenuLink | undefined> {
return this.contextLinks.findOne({
where: {
guild_id: this.guildId,
context_id: id,
},
});
}
async create(contextId: string, contextAction: string): Promise<InsertResult> {
return this.contextLinks.insert({
guild_id: this.guildId,
context_id: contextId,
action_name: contextAction,
});
}
async deleteAll(): Promise<DeleteResult> {
return this.contextLinks.delete({
guild_id: this.guildId,
});
}
}

View file

@ -45,9 +45,9 @@ export class GuildSavedMessages extends BaseGuildRepository {
timestamp: msg.createdTimestamp, timestamp: msg.createdTimestamp,
}; };
if (msg.attachments.size) data.attachments = msg.attachments.array(); if (msg.attachments.size) data.attachments = [...msg.attachments.values()];
if (msg.embeds.length) data.embeds = msg.embeds; if (msg.embeds.length) data.embeds = msg.embeds;
if (msg.stickers?.size) data.stickers = msg.stickers.array(); if (msg.stickers?.size) data.stickers = [...msg.stickers.values()];
return data; return data;
} }

View file

@ -0,0 +1,10 @@
import { Column, Entity, PrimaryColumn } from "typeorm";
@Entity("context_menus")
export class ContextMenuLink {
@Column() guild_id: string;
@Column() @PrimaryColumn() context_id: string;
@Column() action_name: string;
}

View file

@ -26,14 +26,6 @@ if (!process.env.KEY) {
process.exit(1); process.exit(1);
} }
declare global {
// This is here so TypeScript doesn't give an error when importing twemoji
// since one of the signatures of twemoji.parse() takes an HTMLElement but
// we're not in a browser environment so including the DOM lib would not make
// sense
type HTMLElement = unknown;
}
// Error handling // Error handling
let recentPluginErrors = 0; let recentPluginErrors = 0;
const RECENT_PLUGIN_ERROR_EXIT_THRESHOLD = 5; const RECENT_PLUGIN_ERROR_EXIT_THRESHOLD = 5;

View file

@ -0,0 +1,32 @@
import { MigrationInterface, QueryRunner, Table } from "typeorm";
export class CreateContextMenuTable1628809879962 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: "context_menus",
columns: [
{
name: "guild_id",
type: "bigint",
},
{
name: "context_id",
type: "bigint",
isPrimary: true,
isUnique: true,
},
{
name: "action_name",
type: "varchar",
length: "100",
},
],
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable("context_menus");
}
}

View file

@ -73,6 +73,10 @@ const configPreprocessor: ConfigPreprocessorFn<AutomodPluginType> = options => {
rule["enabled"] = true; rule["enabled"] = true;
} }
if (rule["allow_further_rules"] == null) {
rule["allow_further_rules"] = false;
}
if (rule["affects_bots"] == null) { if (rule["affects_bots"] == null) {
rule["affects_bots"] = false; rule["affects_bots"] = false;
} }

View file

@ -53,7 +53,7 @@ export const AddRolesAction = automodAction({
await Promise.all( await Promise.all(
members.map(async member => { members.map(async member => {
const memberRoles = new Set(member.roles.cache.keyArray()); const memberRoles = new Set(member.roles.cache.keys());
for (const roleId of rolesToAssign) { for (const roleId of rolesToAssign) {
memberRoles.add(roleId as Snowflake); memberRoles.add(roleId as Snowflake);
ignoreRoleChange(pluginData, member.id, roleId); ignoreRoleChange(pluginData, member.id, roleId);

View file

@ -54,7 +54,7 @@ export const RemoveRolesAction = automodAction({
await Promise.all( await Promise.all(
members.map(async member => { members.map(async member => {
const memberRoles = new Set(member.roles.cache.keyArray()); const memberRoles = new Set(member.roles.cache.keys());
for (const roleId of rolesToRemove) { for (const roleId of rolesToRemove) {
memberRoles.delete(roleId as Snowflake); memberRoles.delete(roleId as Snowflake);
ignoreRoleChange(pluginData, member.id, roleId); ignoreRoleChange(pluginData, member.id, roleId);

View file

@ -72,7 +72,7 @@ export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>,
matchResult.fullSummary = `Triggered automod rule **${ruleName}**\n${matchResult.summary}`.trim(); matchResult.fullSummary = `Triggered automod rule **${ruleName}**\n${matchResult.summary}`.trim();
break triggerLoop; if (!rule.allow_further_rules) break triggerLoop;
} }
} }
} }
@ -94,7 +94,7 @@ export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>,
}); });
} }
break; if (!rule.allow_further_rules) break;
} }
} }
} }

View file

@ -26,6 +26,7 @@ export const Rule = t.type({
triggers: t.array(t.partial(AvailableTriggers.props)), triggers: t.array(t.partial(AvailableTriggers.props)),
actions: t.partial(AvailableActions.props), actions: t.partial(AvailableActions.props),
cooldown: tNullable(t.string), cooldown: tNullable(t.string),
allow_further_rules: t.boolean,
}); });
export type TRule = t.TypeOf<typeof Rule>; export type TRule = t.TypeOf<typeof Rule>;

View file

@ -52,6 +52,7 @@ export const CensorPlugin = zeppelinGuildPlugin<CensorPluginType>()({
Censor words, tokens, links, regex, etc. Censor words, tokens, links, regex, etc.
For more advanced filtering, check out the Automod plugin! For more advanced filtering, check out the Automod plugin!
`), `),
legacy: true,
}, },
dependencies: [LogsPlugin], dependencies: [LogsPlugin],

View file

@ -0,0 +1,61 @@
import { PluginOptions } from "knub";
import { StrictValidationError } from "src/validatorUtils";
import { ConfigPreprocessorFn } from "knub/dist/config/configTypes";
import { GuildContextMenuLinks } from "../../data/GuildContextMenuLinks";
import { LogsPlugin } from "../Logs/LogsPlugin";
import { MutesPlugin } from "../Mutes/MutesPlugin";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { availableTypes } from "./actions/availableActions";
import { ContextClickedEvt } from "./events/ContextClickedEvt";
import { ConfigSchema, ContextMenuPluginType } from "./types";
import { loadAllCommands } from "./utils/loadAllCommands";
const defaultOptions: PluginOptions<ContextMenuPluginType> = {
config: {
context_actions: {},
},
};
const configPreprocessor: ConfigPreprocessorFn<ContextMenuPluginType> = options => {
if (options.config.context_actions) {
for (const [name, contextMenu] of Object.entries(options.config.context_actions)) {
if (Object.entries(contextMenu.action).length !== 1) {
throw new StrictValidationError([`Invalid value for context_actions/${name}: Must have exactly one action.`]);
}
const actionName = Object.entries(contextMenu.action)[0][0];
if (!availableTypes[actionName].includes(contextMenu.type)) {
throw new StrictValidationError([
`Invalid value for context_actions/${name}/${actionName}: ${actionName} is not allowed on type ${contextMenu.type}.`,
]);
}
}
}
return options;
};
export const ContextMenuPlugin = zeppelinGuildPlugin<ContextMenuPluginType>()({
name: "context_menu",
configSchema: ConfigSchema,
defaultOptions,
configPreprocessor,
// prettier-ignore
events: [
ContextClickedEvt,
],
beforeLoad(pluginData) {
const { state, guild } = pluginData;
state.contextMenuLinks = new GuildContextMenuLinks(guild.id);
},
afterLoad(pluginData) {
loadAllCommands(pluginData);
},
dependencies: [MutesPlugin, LogsPlugin],
});

View file

@ -0,0 +1,19 @@
import * as t from "io-ts";
import { ContextActionBlueprint } from "../helpers";
import { CleanAction } from "./clean";
import { MuteAction } from "./mute";
export const availableActions: Record<string, ContextActionBlueprint<any>> = {
mute: MuteAction,
clean: CleanAction,
};
export const AvailableActions = t.type({
mute: MuteAction.configType,
clean: CleanAction.configType,
});
export const availableTypes: Record<string, string[]> = {
mute: ["USER"],
clean: ["MESSAGE"],
};

View file

@ -0,0 +1,64 @@
import { TextChannel } from "discord.js";
import * as t from "io-ts";
import { canActOn } from "src/pluginUtils";
import { LogType } from "../../../data/LogType";
import { UtilityPlugin } from "../../../plugins/Utility/UtilityPlugin";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import { tNullable } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { contextMenuAction } from "../helpers";
export const CleanAction = contextMenuAction({
configType: t.type({
amount: tNullable(t.number),
targetUserOnly: tNullable(t.boolean),
"delete-pins": tNullable(t.boolean),
}),
defaultConfig: {
amount: 10,
targetUserOnly: false,
"delete-pins": false,
},
async apply({ pluginData, actionConfig, actionName, interaction }) {
interaction.deferReply({ ephemeral: true });
const targetMessage = interaction.channel
? await interaction.channel.messages.fetch(interaction.targetId)
: await (pluginData.guild.channels.resolve(interaction.channelId) as TextChannel).messages.fetch(
interaction.targetId,
);
const amount = actionConfig.amount ?? 10;
const targetUserOnly = actionConfig.targetUserOnly ?? false;
const deletePins = actionConfig["delete-pins"] ?? false;
const user = targetUserOnly ? targetMessage.author.id : undefined;
const targetMember = await pluginData.guild.members.fetch(targetMessage.author.id);
const executingMember = await pluginData.guild.members.fetch(interaction.user.id);
const utility = pluginData.getPlugin(UtilityPlugin);
if (targetUserOnly && !canActOn(pluginData, executingMember, targetMember)) {
interaction.followUp({ ephemeral: true, content: "Cannot clean users messages: insufficient permissions" });
return;
}
try {
interaction.followUp(`Cleaning... Amount: ${amount}, User Only: ${targetUserOnly}, Pins: ${deletePins}`);
utility.clean(
{ count: amount, user, channel: targetMessage.channel.id, "delete-pins": deletePins },
targetMessage,
);
} catch (e) {
interaction.followUp({ ephemeral: true, content: "Plugin error, please check your BOT_ALERTs" });
if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) {
pluginData.getPlugin(LogsPlugin).log(LogType.BOT_ALERT, {
body: `Failed to clean in <#${interaction.channelId}> in ContextMenu action \`${actionName}\``,
});
} else {
throw e;
}
}
},
});

View file

@ -0,0 +1,83 @@
import humanizeDuration from "humanize-duration";
import * as t from "io-ts";
import { canActOn } from "src/pluginUtils";
import { LogType } from "../../../data/LogType";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import { convertDelayStringToMS, tDelayString, tNullable } from "../../../utils";
import { CaseArgs } from "../../Cases/types";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { MutesPlugin } from "../../Mutes/MutesPlugin";
import { contextMenuAction } from "../helpers";
import { resolveActionContactMethods } from "../utils/resolveActionContactMethods";
export const MuteAction = contextMenuAction({
configType: t.type({
reason: tNullable(t.string),
duration: tNullable(tDelayString),
notify: tNullable(t.string),
notifyChannel: tNullable(t.string),
remove_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])),
restore_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])),
postInCaseLog: tNullable(t.boolean),
hide_case: tNullable(t.boolean),
}),
defaultConfig: {
notify: null, // Use defaults from ModActions
hide_case: false,
},
async apply({ pluginData, actionConfig, actionName, interaction }) {
const duration = actionConfig.duration ? convertDelayStringToMS(actionConfig.duration)! : undefined;
const reason = actionConfig.reason || "Context Menu Action";
const contactMethods = actionConfig.notify ? resolveActionContactMethods(pluginData, actionConfig) : undefined;
const rolesToRemove = actionConfig.remove_roles_on_mute;
const rolesToRestore = actionConfig.restore_roles_on_mute;
const caseArgs: Partial<CaseArgs> = {
modId: pluginData.client.user!.id,
automatic: true,
postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined,
hide: Boolean(actionConfig.hide_case),
};
interaction.deferReply({ ephemeral: true });
const mutes = pluginData.getPlugin(MutesPlugin);
const userId = interaction.targetId;
const targetMember = await pluginData.guild.members.fetch(interaction.targetId);
const executingMember = await pluginData.guild.members.fetch(interaction.user.id);
if (!canActOn(pluginData, executingMember, targetMember)) {
interaction.followUp({ ephemeral: true, content: "Cannot mute: insufficient permissions" });
return;
}
try {
const result = await mutes.muteUser(
userId,
duration,
reason,
{ contactMethods, caseArgs, isAutomodAction: true },
rolesToRemove,
rolesToRestore,
);
const muteMessage = `Muted **${result.case.user_name}** ${
duration ? `for ${humanizeDuration(duration)}` : "indefinitely"
} (Case #${result.case.case_number}) (user notified via ${result.notifyResult.method ??
"dm"})\nPlease update the new case with the \`update\` command`;
interaction.followUp({ ephemeral: true, content: muteMessage });
} catch (e) {
interaction.followUp({ ephemeral: true, content: "Plugin error, please check your BOT_ALERTs" });
if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) {
pluginData.getPlugin(LogsPlugin).log(LogType.BOT_ALERT, {
body: `Failed to mute <@!${userId}> in ContextMenu action \`${actionName}\` because a mute role has not been specified in server config`,
});
} else {
throw e;
}
}
},
});

View file

@ -0,0 +1,13 @@
import { ContextMenuInteraction } from "discord.js";
import { contextMenuEvt } from "../types";
import { routeContextAction } from "../utils/contextRouter";
export const ContextClickedEvt = contextMenuEvt({
event: "interactionCreate",
async listener(meta) {
if (!meta.args.interaction.isContextMenu) return;
const inter = meta.args.interaction as ContextMenuInteraction;
await routeContextAction(meta.pluginData, inter);
},
});

View file

@ -0,0 +1,25 @@
import { ContextMenuInteraction } from "discord.js";
import * as t from "io-ts";
import { GuildPluginData } from "knub";
import { Awaitable } from "knub/dist/utils";
import { ContextMenuPluginType } from "./types";
type ContextActionApplyFn<TConfigType> = (meta: {
actionName: string;
pluginData: GuildPluginData<ContextMenuPluginType>;
actionConfig: TConfigType;
interaction: ContextMenuInteraction;
}) => Awaitable<void>;
export interface ContextActionBlueprint<TConfigType extends t.Any> {
configType: TConfigType;
defaultConfig: Partial<t.TypeOf<TConfigType>>;
apply: ContextActionApplyFn<t.TypeOf<TConfigType>>;
}
export function contextMenuAction<TConfigType extends t.Any>(
blueprint: ContextActionBlueprint<TConfigType>,
): ContextActionBlueprint<TConfigType> {
return blueprint;
}

View file

@ -0,0 +1,38 @@
import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub";
import { GuildContextMenuLinks } from "../../data/GuildContextMenuLinks";
import { tNullable } from "../../utils";
import { AvailableActions } from "./actions/availableActions";
export enum ContextMenuTypes {
USER = 2,
MESSAGE = 3,
}
export const ContextMenuTypeNameToNumber: Record<string, number> = {
USER: 2,
MESSAGE: 3,
};
const ContextActionOpts = t.type({
enabled: tNullable(t.boolean),
label: t.string,
type: t.keyof(ContextMenuTypes),
action: t.partial(AvailableActions.props),
});
export type TContextActionOpts = t.TypeOf<typeof ContextActionOpts>;
export const ConfigSchema = t.type({
context_actions: t.record(t.string, ContextActionOpts),
});
export type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
export interface ContextMenuPluginType extends BasePluginType {
config: TConfigSchema;
state: {
contextMenuLinks: GuildContextMenuLinks;
};
}
export const contextMenuCmd = typedGuildCommand<ContextMenuPluginType>();
export const contextMenuEvt = typedGuildEventListener<ContextMenuPluginType>();

View file

@ -0,0 +1,28 @@
import { ContextMenuInteraction } from "discord.js";
import { GuildPluginData } from "knub";
import { availableActions } from "../actions/availableActions";
import { ContextMenuPluginType } from "../types";
export async function routeContextAction(
pluginData: GuildPluginData<ContextMenuPluginType>,
interaction: ContextMenuInteraction,
) {
const contextLink = await pluginData.state.contextMenuLinks.get(interaction.commandId);
if (!contextLink) return;
const contextActions = Object.entries(pluginData.config.get().context_actions);
const configLink = contextActions.find(x => x[0] === contextLink.action_name);
if (!configLink) return;
for (const [actionName, actionConfig] of Object.entries(configLink[1].action)) {
if (actionConfig == null) return;
const action = availableActions[actionName];
action.apply({
actionName,
pluginData,
actionConfig,
interaction,
});
return;
}
}

View file

@ -0,0 +1,37 @@
import { ApplicationCommandData } from "discord.js";
import { LogType } from "src/data/LogType";
import { LogsPlugin } from "src/plugins/Logs/LogsPlugin";
import { GuildPluginData } from "knub";
import { ContextMenuPluginType, ContextMenuTypeNameToNumber } from "../types";
export async function loadAllCommands(pluginData: GuildPluginData<ContextMenuPluginType>) {
const comms = await pluginData.client.application!.commands;
const actions = pluginData.config.get().context_actions;
const newCommands: ApplicationCommandData[] = [];
const addedNames: string[] = [];
for (const [name, configAction] of Object.entries(actions)) {
if (!configAction.enabled) continue;
const data: ApplicationCommandData = {
type: ContextMenuTypeNameToNumber[configAction.type],
name: configAction.label,
};
addedNames.push(name);
newCommands.push(data);
}
const setCommands = await comms.set(newCommands, pluginData.guild.id).catch(e => {
pluginData.getPlugin(LogsPlugin).log(LogType.BOT_ALERT, `Unable to overwrite context menus: ${e}`);
return undefined;
});
if (!setCommands) return;
const setCommandsArray = [...setCommands.values()];
await pluginData.state.contextMenuLinks.deleteAll();
for (let i = 0; i < setCommandsArray.length; i++) {
const command = setCommandsArray[i];
pluginData.state.contextMenuLinks.create(command.id, addedNames[i]);
}
}

View file

@ -0,0 +1,32 @@
import { Snowflake, TextChannel } from "discord.js";
import { GuildPluginData } from "knub";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import { disableUserNotificationStrings, UserNotificationMethod } from "../../../utils";
import { ContextMenuPluginType } from "../types";
export function resolveActionContactMethods(
pluginData: GuildPluginData<ContextMenuPluginType>,
actionConfig: {
notify?: string | null;
notifyChannel?: string | null;
},
): UserNotificationMethod[] {
if (actionConfig.notify === "dm") {
return [{ type: "dm" }];
} else if (actionConfig.notify === "channel") {
if (!actionConfig.notifyChannel) {
throw new RecoverablePluginError(ERRORS.NO_USER_NOTIFICATION_CHANNEL);
}
const channel = pluginData.guild.channels.cache.get(actionConfig.notifyChannel as Snowflake);
if (!(channel instanceof TextChannel)) {
throw new RecoverablePluginError(ERRORS.INVALID_USER_NOTIFICATION_CHANNEL);
}
return [{ type: "channel", channel }];
} else if (actionConfig.notify && disableUserNotificationStrings.includes(actionConfig.notify)) {
return [];
}
return [];
}

View file

@ -31,6 +31,6 @@ export async function addRoleAction(
const rolesToAdd = Array.isArray(action.role) ? action.role : [action.role]; const rolesToAdd = Array.isArray(action.role) ? action.role : [action.role];
await target.edit({ await target.edit({
roles: Array.from(new Set([...target.roles.cache.array(), ...rolesToAdd])) as Snowflake[], roles: Array.from(new Set([...target.roles.cache.values(), ...rolesToAdd])) as Snowflake[],
}); });
} }

View file

@ -27,8 +27,8 @@ export const LogsGuildMemberUpdateEvt = logsEvt({
} }
if (!isEqual(oldMember.roles, member.roles)) { if (!isEqual(oldMember.roles, member.roles)) {
const addedRoles = diff(member.roles.cache.keyArray(), oldMember.roles.cache.keyArray()); const addedRoles = diff([...member.roles.cache.keys()], [...oldMember.roles.cache.keys()]);
const removedRoles = diff(oldMember.roles.cache.keyArray(), member.roles.cache.keyArray()); const removedRoles = diff([...oldMember.roles.cache.keys()], [...member.roles.cache.keys()]);
let skip = false; let skip = false;
if ( if (

View file

@ -14,6 +14,11 @@ import {
} from "../../../utils"; } from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin"; import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { FORMAT_NO_TIMESTAMP, LogsPluginType, TLogChannel } from "../types"; import { FORMAT_NO_TIMESTAMP, LogsPluginType, TLogChannel } from "../types";
import {
getConfigAccessibleMemberLevel,
IConfigAccessibleMember,
memberToConfigAccessibleMember,
} from "../../../utils/configAccessibleObjects";
export async function getLogMessage( export async function getLogMessage(
pluginData: GuildPluginData<LogsPluginType>, pluginData: GuildPluginData<LogsPluginType>,
@ -48,17 +53,26 @@ export async function getLogMessage(
const mentions: string[] = []; const mentions: string[] = [];
for (const userOrMember of usersOrMembers) { for (const userOrMember of usersOrMembers) {
let user; let user;
let member; let member: IConfigAccessibleMember | null = null;
if (userOrMember.user) { if (userOrMember.user) {
member = userOrMember; member = userOrMember as IConfigAccessibleMember;
user = member.user; user = member.user;
} else { } else {
user = userOrMember; user = userOrMember;
member = await resolveMember(pluginData.client, pluginData.guild, user.id); const apiMember = await resolveMember(pluginData.client, pluginData.guild, user.id);
if (apiMember) {
member = memberToConfigAccessibleMember(apiMember);
}
} }
const memberConfig = (await pluginData.config.getMatchingConfig({ member, userId: user.id })) || ({} as any); const level = member ? getConfigAccessibleMemberLevel(pluginData, member) : 0;
const memberConfig =
(await pluginData.config.getMatchingConfig({
level,
memberRoles: member ? member.roles.map(r => r.id) : [],
userId: user.id,
})) || ({} as any);
// Revert to old behavior (verbose name w/o ping if allow_user_mentions is enabled (for whatever reason)) // Revert to old behavior (verbose name w/o ping if allow_user_mentions is enabled (for whatever reason))
if (config.allow_user_mentions) { if (config.allow_user_mentions) {

View file

@ -16,7 +16,7 @@ export const SavePinsToDBCmd = messageSaverCmd({
await msg.channel.send(`Saving pins from <#${args.channel.id}>...`); await msg.channel.send(`Saving pins from <#${args.channel.id}>...`);
const pins = await args.channel.messages.fetchPinned(); const pins = await args.channel.messages.fetchPinned();
const { savedCount, failed } = await saveMessagesToDB(pluginData, args.channel, pins.keyArray()); const { savedCount, failed } = await saveMessagesToDB(pluginData, args.channel, [...pins.keys()]);
if (failed.length) { if (failed.length) {
sendSuccessMessage( sendSuccessMessage(

View file

@ -60,7 +60,7 @@ export const AddCaseCmd = modActionsCmd({
return; return;
} }
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array()); const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
// Create the case // Create the case
const casesPlugin = pluginData.getPlugin(CasesPlugin); const casesPlugin = pluginData.getPlugin(CasesPlugin);

View file

@ -51,7 +51,7 @@ export const BanCmd = modActionsCmd({
} }
const time = args["time"] ? args["time"] : null; const time = args["time"] ? args["time"] : null;
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array()); const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
const memberToBan = await resolveMember(pluginData.client, pluginData.guild, user.id); const memberToBan = await resolveMember(pluginData.client, pluginData.guild, user.id);
// The moderator who did the action is the message author or, if used, the specified -mod // The moderator who did the action is the message author or, if used, the specified -mod
let mod = msg.member; let mod = msg.member;

View file

@ -61,7 +61,7 @@ export const ForcebanCmd = modActionsCmd({
mod = args.mod; mod = args.mod;
} }
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array()); const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
ignoreEvent(pluginData, IgnoredEventType.Ban, user.id); ignoreEvent(pluginData, IgnoredEventType.Ban, user.id);
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, user.id); pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, user.id);

View file

@ -39,7 +39,7 @@ export const MassbanCmd = modActionsCmd({
return; return;
} }
const banReason = formatReasonWithAttachments(banReasonReply.content, msg.attachments.array()); const banReason = formatReasonWithAttachments(banReasonReply.content, [...msg.attachments.values()]);
// Verify we can act on each of the users specified // Verify we can act on each of the users specified
for (const userId of args.userIds) { for (const userId of args.userIds) {

View file

@ -37,7 +37,7 @@ export const MassunbanCmd = modActionsCmd({
return; return;
} }
const unbanReason = formatReasonWithAttachments(unbanReasonReply.content, msg.attachments.array()); const unbanReason = formatReasonWithAttachments(unbanReasonReply.content, [...msg.attachments.values()]);
// Ignore automatic unban cases and logs for these users // Ignore automatic unban cases and logs for these users
// We'll create our own cases below and post a single "mass unbanned" log instead // We'll create our own cases below and post a single "mass unbanned" log instead

View file

@ -39,7 +39,7 @@ export const MassmuteCmd = modActionsCmd({
return; return;
} }
const muteReason = formatReasonWithAttachments(muteReasonReceived.content, msg.attachments.array()); const muteReason = formatReasonWithAttachments(muteReasonReceived.content, [...msg.attachments.values()]);
// Verify we can act upon all users // Verify we can act upon all users
for (const userId of args.userIds) { for (const userId of args.userIds) {

View file

@ -31,7 +31,7 @@ export const NoteCmd = modActionsCmd({
} }
const userName = user.tag; const userName = user.tag;
const reason = formatReasonWithAttachments(args.note, msg.attachments.array()); const reason = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
const casesPlugin = pluginData.getPlugin(CasesPlugin); const casesPlugin = pluginData.getPlugin(CasesPlugin);
const createdCase = await casesPlugin.createCase({ const createdCase = await casesPlugin.createCase({

View file

@ -47,7 +47,7 @@ export const UnbanCmd = modActionsCmd({
} }
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_UNBAN, user.id); pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_UNBAN, user.id);
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array()); const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
try { try {
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id); ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);

View file

@ -63,7 +63,7 @@ export const WarnCmd = modActionsCmd({
} }
const config = pluginData.config.get(); const config = pluginData.config.get();
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array()); const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
const casesPlugin = pluginData.getPlugin(CasesPlugin); const casesPlugin = pluginData.getPlugin(CasesPlugin);
const priorWarnAmount = await casesPlugin.getCaseTypeAmountForUserId(memberToWarn.id, CaseTypes.Warn); const priorWarnAmount = await casesPlugin.getCaseTypeAmountForUserId(memberToWarn.id, CaseTypes.Warn);

View file

@ -42,7 +42,7 @@ export async function actualMuteUserCmd(
} }
const timeUntilUnmute = args.time && humanizeDuration(args.time); const timeUntilUnmute = args.time && humanizeDuration(args.time);
const reason = args.reason ? formatReasonWithAttachments(args.reason, msg.attachments.array()) : undefined; const reason = args.reason ? formatReasonWithAttachments(args.reason, [...msg.attachments.values()]) : undefined;
let muteResult: MuteResult; let muteResult: MuteResult;
const mutesPlugin = pluginData.getPlugin(MutesPlugin); const mutesPlugin = pluginData.getPlugin(MutesPlugin);

View file

@ -27,7 +27,7 @@ export async function actualUnmuteCmd(
pp = msg.author; pp = msg.author;
} }
const reason = args.reason ? formatReasonWithAttachments(args.reason, msg.attachments.array()) : undefined; const reason = args.reason ? formatReasonWithAttachments(args.reason, [...msg.attachments.values()]) : undefined;
const mutesPlugin = pluginData.getPlugin(MutesPlugin); const mutesPlugin = pluginData.getPlugin(MutesPlugin);
const result = await mutesPlugin.unmuteUser(user.id, args.time, { const result = await mutesPlugin.unmuteUser(user.id, args.time, {

View file

@ -24,7 +24,7 @@ export async function updateCase(pluginData, msg: Message, args) {
return; return;
} }
const note = formatReasonWithAttachments(args.note, msg.attachments.array()); const note = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
const casesPlugin = pluginData.getPlugin(CasesPlugin); const casesPlugin = pluginData.getPlugin(CasesPlugin);
await casesPlugin.createCaseNote({ await casesPlugin.createCaseNote({

View file

@ -21,7 +21,7 @@ export async function clearExpiredMutes(pluginData: GuildPluginData<MutesPluginT
} }
if (mute.roles_to_restore) { if (mute.roles_to_restore) {
const guildRoles = pluginData.guild.roles.cache; const guildRoles = pluginData.guild.roles.cache;
let newRoles: string[] = member.roles.cache.keyArray(); let newRoles = [...member.roles.cache.keys()];
newRoles = newRoles =
muteRole && newRoles.includes(muteRole) ? newRoles.splice(newRoles.indexOf(muteRole), 1) : newRoles; muteRole && newRoles.includes(muteRole) ? newRoles.splice(newRoles.indexOf(muteRole), 1) : newRoles;
for (const toRestore of mute.roles_to_restore) { for (const toRestore of mute.roles_to_restore) {

View file

@ -58,7 +58,7 @@ export async function muteUser(
if (member) { if (member) {
const logs = pluginData.getPlugin(LogsPlugin); const logs = pluginData.getPlugin(LogsPlugin);
// remove and store any roles to be removed/restored // remove and store any roles to be removed/restored
const currentUserRoles = member.roles.cache.keyArray(); const currentUserRoles = [...member.roles.cache.keys()];
let newRoles: string[] = currentUserRoles; let newRoles: string[] = currentUserRoles;
const removeRoles = removeRolesOnMuteOverride ?? config.remove_roles_on_mute; const removeRoles = removeRolesOnMuteOverride ?? config.remove_roles_on_mute;
const restoreRoles = restoreRolesOnMuteOverride ?? config.restore_roles_on_mute; const restoreRoles = restoreRolesOnMuteOverride ?? config.restore_roles_on_mute;

View file

@ -42,7 +42,7 @@ export async function unmuteUser(
} }
if (existingMute?.roles_to_restore) { if (existingMute?.roles_to_restore) {
const guildRoles = pluginData.guild.roles.cache; const guildRoles = pluginData.guild.roles.cache;
let newRoles: string[] = member.roles.cache.keyArray(); let newRoles = [...member.roles.cache.keys()];
newRoles = muteRole && newRoles.includes(muteRole) ? newRoles.splice(newRoles.indexOf(muteRole), 1) : newRoles; newRoles = muteRole && newRoles.includes(muteRole) ? newRoles.splice(newRoles.indexOf(muteRole), 1) : newRoles;
for (const toRestore of existingMute.roles_to_restore) { for (const toRestore of existingMute.roles_to_restore) {
if (guildRoles.has(toRestore as Snowflake) && toRestore !== muteRole) newRoles.push(toRestore); if (guildRoles.has(toRestore as Snowflake) && toRestore !== muteRole) newRoles.push(toRestore);

View file

@ -141,7 +141,7 @@ export async function actualPostCmd(
author_name: msg.author.tag, author_name: msg.author.tag,
channel_id: targetChannel.id, channel_id: targetChannel.id,
content, content,
attachments: msg.attachments.array(), attachments: [...msg.attachments.values()],
post_at: postAt post_at: postAt
.clone() .clone()
.tz("Etc/UTC") .tz("Etc/UTC")
@ -180,7 +180,7 @@ export async function actualPostCmd(
// When the message isn't scheduled for later, post it immediately // When the message isn't scheduled for later, post it immediately
if (!opts.schedule) { if (!opts.schedule) {
await postMessage(pluginData, targetChannel, content, msg.attachments.array(), opts["enable-mentions"]); await postMessage(pluginData, targetChannel, content, [...msg.attachments.values()], opts["enable-mentions"]);
} }
if (opts.repeat) { if (opts.repeat) {

View file

@ -24,7 +24,7 @@ export async function addMemberPendingRoleChange(
const member = await resolveMember(pluginData.client, pluginData.guild, memberId); const member = await resolveMember(pluginData.client, pluginData.guild, memberId);
if (member) { if (member) {
const newRoleIds = new Set(member.roles.cache.keyArray()); const newRoleIds = new Set(member.roles.cache.keys());
for (const change of newPendingRoleChangeObj.changes) { for (const change of newPendingRoleChangeObj.changes) {
if (change.mode === "+") newRoleIds.add(change.roleId as Snowflake); if (change.mode === "+") newRoleIds.add(change.roleId as Snowflake);
else newRoleIds.delete(change.roleId as Snowflake); else newRoleIds.delete(change.roleId as Snowflake);

View file

@ -43,6 +43,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({
pluginData, pluginData,
msg.channel, msg.channel,
`<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`,
{ users: [msg.author.id] },
); );
lock.unlock(); lock.unlock();
return; return;
@ -87,6 +88,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({
pluginData, pluginData,
msg.channel, msg.channel,
`<@!${msg.author.id}> Got an error while trying to grant you the roles`, `<@!${msg.author.id}> Got an error while trying to grant you the roles`,
{ users: [msg.author.id] },
); );
return; return;
} }
@ -118,7 +120,9 @@ export const RoleAddCmd = selfGrantableRolesCmd({
messageParts.push("couldn't recognize some of the roles"); messageParts.push("couldn't recognize some of the roles");
} }
sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`); sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`, {
users: [msg.author.id],
});
lock.unlock(); lock.unlock();
}, },

View file

@ -51,12 +51,14 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({
msg.channel, msg.channel,
`<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord};` + `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord};` +
` couldn't recognize the other roles you mentioned`, ` couldn't recognize the other roles you mentioned`,
{ users: [msg.author.id] },
); );
} else { } else {
sendSuccessMessage( sendSuccessMessage(
pluginData, pluginData,
msg.channel, msg.channel,
`<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`,
{ users: [msg.author.id] },
); );
} }
} catch { } catch {
@ -64,6 +66,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({
pluginData, pluginData,
msg.channel, msg.channel,
`<@!${msg.author.id}> Got an error while trying to remove the roles`, `<@!${msg.author.id}> Got an error while trying to remove the roles`,
{ users: [msg.author.id] },
); );
} }
} else { } else {
@ -71,6 +74,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({
pluginData, pluginData,
msg.channel, msg.channel,
`<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`,
{ users: [msg.author.id] },
); );
} }

View file

@ -51,6 +51,7 @@ export const SpamPlugin = zeppelinGuildPlugin<SpamPluginType>()({
Basic spam detection and auto-muting. Basic spam detection and auto-muting.
For more advanced spam filtering, check out the Automod plugin! For more advanced spam filtering, check out the Automod plugin!
`), `),
legacy: true,
}, },
dependencies: [LogsPlugin], dependencies: [LogsPlugin],

View file

@ -31,7 +31,7 @@ export const MigratePinsCmd = starboardCmd({
msg.channel.send(`Migrating pins from <#${args.pinChannel.id}> to <#${starboardChannel.id}>...`); msg.channel.send(`Migrating pins from <#${args.pinChannel.id}> to <#${starboardChannel.id}>...`);
const pins = (await args.pinChannel.messages.fetchPinned()).array(); const pins = [...(await args.pinChannel.messages.fetchPinned().catch(() => [])).values()];
pins.reverse(); // Migrate pins starting from the oldest message pins.reverse(); // Migrate pins starting from the oldest message
for (const pin of pins) { for (const pin of pins) {

View file

@ -13,7 +13,7 @@ import { AboutCmd } from "./commands/AboutCmd";
import { AvatarCmd } from "./commands/AvatarCmd"; import { AvatarCmd } from "./commands/AvatarCmd";
import { BanSearchCmd } from "./commands/BanSearchCmd"; import { BanSearchCmd } from "./commands/BanSearchCmd";
import { ChannelInfoCmd } from "./commands/ChannelInfoCmd"; import { ChannelInfoCmd } from "./commands/ChannelInfoCmd";
import { CleanCmd } from "./commands/CleanCmd"; import { CleanArgs, cleanCmd, CleanCmd } from "./commands/CleanCmd";
import { ContextCmd } from "./commands/ContextCmd"; import { ContextCmd } from "./commands/ContextCmd";
import { EmojiInfoCmd } from "./commands/EmojiInfoCmd"; import { EmojiInfoCmd } from "./commands/EmojiInfoCmd";
import { HelpCmd } from "./commands/HelpCmd"; import { HelpCmd } from "./commands/HelpCmd";
@ -156,6 +156,14 @@ export const UtilityPlugin = zeppelinGuildPlugin<UtilityPluginType>()({
AutoJoinThreadSyncEvt, AutoJoinThreadSyncEvt,
], ],
public: {
clean(pluginData) {
return (args: CleanArgs, msg) => {
cleanCmd(pluginData, args, msg);
};
},
},
beforeLoad(pluginData) { beforeLoad(pluginData) {
const { state, guild } = pluginData; const { state, guild } = pluginData;

View file

@ -10,12 +10,13 @@ import { getBaseUrl, sendErrorMessage, sendSuccessMessage } from "../../../plugi
import { allowTimeout } from "../../../RegExpRunner"; import { allowTimeout } from "../../../RegExpRunner";
import { DAYS, getInviteCodesInString, noop, SECONDS } from "../../../utils"; import { DAYS, getInviteCodesInString, noop, SECONDS } from "../../../utils";
import { utilityCmd, UtilityPluginType } from "../types"; import { utilityCmd, UtilityPluginType } from "../types";
import { boolean, number } from "io-ts";
const MAX_CLEAN_COUNT = 150; const MAX_CLEAN_COUNT = 150;
const MAX_CLEAN_TIME = 1 * DAYS; const MAX_CLEAN_TIME = 1 * DAYS;
const CLEAN_COMMAND_DELETE_DELAY = 5 * SECONDS; const CLEAN_COMMAND_DELETE_DELAY = 5 * SECONDS;
async function cleanMessages( export async function cleanMessages(
pluginData: GuildPluginData<UtilityPluginType>, pluginData: GuildPluginData<UtilityPluginType>,
channel: TextChannel, channel: TextChannel,
savedMessages: SavedMessage[], savedMessages: SavedMessage[],
@ -61,6 +62,142 @@ const opts = {
"to-id": ct.anyId({ option: true, shortcut: "id" }), "to-id": ct.anyId({ option: true, shortcut: "id" }),
}; };
export interface CleanArgs {
count: number;
update?: boolean;
user?: string;
channel?: string;
bots?: boolean;
"delete-pins"?: boolean;
"has-invites"?: boolean;
match?: RegExp;
"to-id"?: string;
}
export async function cleanCmd(pluginData: GuildPluginData<UtilityPluginType>, args: CleanArgs | any, msg) {
if (args.count > MAX_CLEAN_COUNT || args.count <= 0) {
sendErrorMessage(pluginData, msg.channel, `Clean count must be between 1 and ${MAX_CLEAN_COUNT}`);
return;
}
const targetChannel = args.channel ? pluginData.guild.channels.cache.get(args.channel as Snowflake) : msg.channel;
if (!targetChannel || !(targetChannel instanceof TextChannel)) {
sendErrorMessage(pluginData, msg.channel, `Invalid channel specified`);
return;
}
if (targetChannel.id !== msg.channel.id) {
const configForTargetChannel = await pluginData.config.getMatchingConfig({
userId: msg.author.id,
member: msg.member,
channelId: targetChannel.id,
categoryId: targetChannel.parentId,
});
if (configForTargetChannel.can_clean !== true) {
sendErrorMessage(pluginData, msg.channel, `Missing permissions to use clean on that channel`);
return;
}
}
const cleaningMessage = msg.channel.send("Cleaning...");
const messagesToClean: SavedMessage[] = [];
let beforeId = msg.id;
const timeCutoff = msg.createdTimestamp - MAX_CLEAN_TIME;
const upToMsgId = args["to-id"];
let foundId = false;
const deletePins = args["delete-pins"] != null ? args["delete-pins"] : false;
let pins: Message[] = [];
if (!deletePins) {
pins = [...(await msg.channel.messages.fetchPinned().catch(() => [])).values()];
}
while (messagesToClean.length < args.count) {
const potentialMessages = await targetChannel.messages.fetch({
before: beforeId,
limit: args.count,
});
if (potentialMessages.size === 0) break;
const existingStored = await pluginData.state.savedMessages.getMultiple([...potentialMessages.keys()]);
const alreadyStored = existingStored.map(stored => stored.id);
const messagesToStore = [
...potentialMessages.filter(potentialMsg => !alreadyStored.includes(potentialMsg.id)).values(),
];
await pluginData.state.savedMessages.createFromMessages(messagesToStore);
const potentialMessagesToClean = await pluginData.state.savedMessages.getMultiple([...potentialMessages.keys()]);
if (potentialMessagesToClean.length === 0) break;
const filtered: SavedMessage[] = [];
for (const message of potentialMessagesToClean) {
const contentString = message.data.content || "";
if (args.user && message.user_id !== args.user) continue;
if (args.bots && !message.is_bot) continue;
if (!deletePins && pins.find(x => x.id === message.id) != null) continue;
if (args["has-invites"] && getInviteCodesInString(contentString).length === 0) continue;
if (upToMsgId != null && message.id < upToMsgId) {
foundId = true;
break;
}
if (moment.utc(message.posted_at).valueOf() < timeCutoff) continue;
if (args.match && !(await pluginData.state.regexRunner.exec(args.match, contentString).catch(allowTimeout))) {
continue;
}
filtered.push(message);
}
const remaining = args.count - messagesToClean.length;
const withoutOverflow = filtered.slice(0, remaining);
messagesToClean.push(...withoutOverflow);
beforeId = potentialMessages.lastKey()!;
if (foundId || moment.utc(potentialMessages.last()!.createdTimestamp).valueOf() < timeCutoff) {
break;
}
}
let responseMsg: Message | undefined;
if (messagesToClean.length > 0) {
const cleanResult = await cleanMessages(pluginData, targetChannel, messagesToClean, msg.author);
let responseText = `Cleaned ${messagesToClean.length} ${messagesToClean.length === 1 ? "message" : "messages"}`;
if (targetChannel.id !== msg.channel.id) {
responseText += ` in <#${targetChannel.id}>: ${cleanResult.archiveUrl}`;
}
if (args.update) {
const modActions = pluginData.getPlugin(ModActionsPlugin);
const channelId = targetChannel.id !== msg.channel.id ? targetChannel.id : msg.channel.id;
const updateMessage = `Cleaned ${messagesToClean.length} ${
messagesToClean.length === 1 ? "message" : "messages"
} in <#${channelId}>: ${cleanResult.archiveUrl}`;
if (typeof args.update === "number") {
modActions.updateCase(msg, args.update, updateMessage);
} else {
modActions.updateCase(msg, null, updateMessage);
}
}
responseMsg = await sendSuccessMessage(pluginData, msg.channel, responseText);
} else {
responseMsg = await sendErrorMessage(pluginData, msg.channel, `Found no messages to clean!`);
}
await (await cleaningMessage).delete();
if (targetChannel.id === msg.channel.id) {
// Delete the !clean command and the bot response if a different channel wasn't specified
// (so as not to spam the cleaned channel with the command itself)
setTimeout(() => {
msg.delete().catch(noop);
responseMsg?.delete().catch(noop);
}, CLEAN_COMMAND_DELETE_DELAY);
}
}
export const CleanCmd = utilityCmd({ export const CleanCmd = utilityCmd({
trigger: ["clean", "clear"], trigger: ["clean", "clear"],
description: "Remove a number of recent messages", description: "Remove a number of recent messages",
@ -83,126 +220,6 @@ export const CleanCmd = utilityCmd({
], ],
async run({ message: msg, args, pluginData }) { async run({ message: msg, args, pluginData }) {
if (args.count > MAX_CLEAN_COUNT || args.count <= 0) { cleanCmd(pluginData, args, msg);
sendErrorMessage(pluginData, msg.channel, `Clean count must be between 1 and ${MAX_CLEAN_COUNT}`);
return;
}
const targetChannel = args.channel ? pluginData.guild.channels.cache.get(args.channel as Snowflake) : msg.channel;
if (!targetChannel || !(targetChannel instanceof TextChannel)) {
sendErrorMessage(pluginData, msg.channel, `Invalid channel specified`);
return;
}
if (targetChannel.id !== msg.channel.id) {
const configForTargetChannel = await pluginData.config.getMatchingConfig({
userId: msg.author.id,
member: msg.member,
channelId: targetChannel.id,
categoryId: targetChannel.parentId,
});
if (configForTargetChannel.can_clean !== true) {
sendErrorMessage(pluginData, msg.channel, `Missing permissions to use clean on that channel`);
return;
}
}
const cleaningMessage = msg.channel.send("Cleaning...");
const messagesToClean: SavedMessage[] = [];
let beforeId = msg.id;
const timeCutoff = msg.createdTimestamp - MAX_CLEAN_TIME;
const upToMsgId = args["to-id"];
let foundId = false;
const deletePins = args["delete-pins"] != null ? args["delete-pins"] : false;
let pins: Message[] = [];
if (!deletePins) {
pins = (await msg.channel.messages.fetchPinned()).array();
}
while (messagesToClean.length < args.count) {
const potentialMessages = await targetChannel.messages.fetch({
before: beforeId,
limit: args.count,
});
if (potentialMessages.size === 0) break;
const existingStored = await pluginData.state.savedMessages.getMultiple(potentialMessages.keyArray());
const alreadyStored = existingStored.map(stored => stored.id);
const messagesToStore = potentialMessages
.array()
.filter(potentialMsg => !alreadyStored.includes(potentialMsg.id));
await pluginData.state.savedMessages.createFromMessages(messagesToStore);
const potentialMessagesToClean = await pluginData.state.savedMessages.getMultiple(potentialMessages.keyArray());
if (potentialMessagesToClean.length === 0) break;
const filtered: SavedMessage[] = [];
for (const message of potentialMessagesToClean) {
const contentString = message.data.content || "";
if (args.user && message.user_id !== args.user) continue;
if (args.bots && !message.is_bot) continue;
if (!deletePins && pins.find(x => x.id === message.id) != null) continue;
if (args["has-invites"] && getInviteCodesInString(contentString).length === 0) continue;
if (upToMsgId != null && message.id < upToMsgId) {
foundId = true;
break;
}
if (moment.utc(message.posted_at).valueOf() < timeCutoff) continue;
if (args.match && !(await pluginData.state.regexRunner.exec(args.match, contentString).catch(allowTimeout))) {
continue;
}
filtered.push(message);
}
const remaining = args.count - messagesToClean.length;
const withoutOverflow = filtered.slice(0, remaining);
messagesToClean.push(...withoutOverflow);
beforeId = potentialMessages.lastKey()!;
if (foundId || moment.utc(potentialMessages.last()!.createdTimestamp).valueOf() < timeCutoff) {
break;
}
}
let responseMsg: Message | undefined;
if (messagesToClean.length > 0) {
const cleanResult = await cleanMessages(pluginData, targetChannel, messagesToClean, msg.author);
let responseText = `Cleaned ${messagesToClean.length} ${messagesToClean.length === 1 ? "message" : "messages"}`;
if (targetChannel.id !== msg.channel.id) {
responseText += ` in <#${targetChannel.id}>: ${cleanResult.archiveUrl}`;
}
if (args.update) {
const modActions = pluginData.getPlugin(ModActionsPlugin);
const channelId = targetChannel.id !== msg.channel.id ? targetChannel.id : msg.channel.id;
const updateMessage = `Cleaned ${messagesToClean.length} ${
messagesToClean.length === 1 ? "message" : "messages"
} in <#${channelId}>: ${cleanResult.archiveUrl}`;
if (typeof args.update === "number") {
modActions.updateCase(msg, args.update, updateMessage);
} else {
modActions.updateCase(msg, null, updateMessage);
}
}
responseMsg = await sendSuccessMessage(pluginData, msg.channel, responseText);
} else {
responseMsg = await sendErrorMessage(pluginData, msg.channel, `Found no messages to clean!`);
}
await (await cleaningMessage).delete();
if (targetChannel.id === msg.channel.id) {
// Delete the !clean command and the bot response if a different channel wasn't specified
// (so as not to spam the cleaned channel with the command itself)
setTimeout(() => {
msg.delete().catch(noop);
responseMsg?.delete().catch(noop);
}, CLEAN_COMMAND_DELETE_DELAY);
}
}, },
}); });

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils"; import { sendErrorMessage } from "../../../pluginUtils";
import { customEmojiRegex } from "../../../utils";
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed"; import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed";
import { getCustomEmojiId } from "../functions/getCustomEmojiId";
import { utilityCmd } from "../types"; import { utilityCmd } from "../types";
export const EmojiInfoCmd = utilityCmd({ export const EmojiInfoCmd = utilityCmd({
@ -11,17 +11,17 @@ export const EmojiInfoCmd = utilityCmd({
permission: "can_emojiinfo", permission: "can_emojiinfo",
signature: { signature: {
emoji: ct.string({ required: false }), emoji: ct.string({ required: true }),
}, },
async run({ message, args, pluginData }) { async run({ message, args, pluginData }) {
const emojiIdMatch = args.emoji.match(customEmojiRegex); const emojiId = getCustomEmojiId(args.emoji);
if (!emojiIdMatch?.[2]) { if (!emojiId) {
sendErrorMessage(pluginData, message.channel, "Emoji not found"); sendErrorMessage(pluginData, message.channel, "Emoji not found");
return; return;
} }
const embed = await getEmojiInfoEmbed(pluginData, emojiIdMatch[2]); const embed = await getEmojiInfoEmbed(pluginData, emojiId);
if (!embed) { if (!embed) {
sendErrorMessage(pluginData, message.channel, "Emoji not found"); sendErrorMessage(pluginData, message.channel, "Emoji not found");
return; return;

View file

@ -2,26 +2,20 @@ import { Snowflake } from "discord.js";
import { getChannelId, getRoleId } from "knub/dist/utils"; import { getChannelId, getRoleId } from "knub/dist/utils";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils"; import { sendErrorMessage } from "../../../pluginUtils";
import { import { isValidSnowflake, noop, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils";
customEmojiRegex, import { getUserInfoEmbed } from "../functions/getUserInfoEmbed";
isValidSnowflake,
noop,
parseInviteCodeInput,
resolveInvite,
resolveUser,
} from "../../../utils";
import { canReadChannel } from "../../../utils/canReadChannel"; import { canReadChannel } from "../../../utils/canReadChannel";
import { resolveMessageTarget } from "../../../utils/resolveMessageTarget"; import { resolveMessageTarget } from "../../../utils/resolveMessageTarget";
import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed"; import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed";
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed";
import { getGuildPreview } from "../functions/getGuildPreview"; import { getGuildPreview } from "../functions/getGuildPreview";
import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed"; import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed";
import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed"; import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed";
import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed"; import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed";
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed";
import { getCustomEmojiId } from "../functions/getCustomEmojiId";
import { utilityCmd } from "../types";
import { getServerInfoEmbed } from "../functions/getServerInfoEmbed"; import { getServerInfoEmbed } from "../functions/getServerInfoEmbed";
import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed"; import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed";
import { getUserInfoEmbed } from "../functions/getUserInfoEmbed";
import { utilityCmd } from "../types";
export const InfoCmd = utilityCmd({ export const InfoCmd = utilityCmd({
trigger: "info", trigger: "info",
@ -139,9 +133,9 @@ export const InfoCmd = utilityCmd({
// 8. Emoji // 8. Emoji
if (userCfg.can_emojiinfo) { if (userCfg.can_emojiinfo) {
const emojiIdMatch = value.match(customEmojiRegex); const emojiId = getCustomEmojiId(value);
if (emojiIdMatch?.[2]) { if (emojiId) {
const embed = await getEmojiInfoEmbed(pluginData, emojiIdMatch[2]); const embed = await getEmojiInfoEmbed(pluginData, emojiId);
if (embed) { if (embed) {
message.channel.send({ embeds: [embed] }); message.channel.send({ embeds: [embed] });
return; return;

View file

@ -1,6 +1,6 @@
import { MessageAttachment } from "discord.js"; import { MessageAttachment } from "discord.js";
import fs from "fs"; import fs from "fs";
import sharp from "sharp"; import photon from "@silvia-odwyer/photon-node";
import twemoji from "twemoji"; import twemoji from "twemoji";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils"; import { sendErrorMessage } from "../../../pluginUtils";
@ -14,12 +14,21 @@ async function getBufferFromUrl(url: string): Promise<Buffer> {
return fsp.readFile(downloadedEmoji.path); return fsp.readFile(downloadedEmoji.path);
} }
async function resizeBuffer(input: Buffer, width: number, height: number): Promise<Buffer> { function bufferToPhotonImage(input: Buffer): photon.PhotonImage {
return sharp(input, { density: 800 }) const base64 = input.toString("base64").replace(/^data:image\/\w+;base64,/, "");
.resize(width, height, {
fit: "inside", return photon.PhotonImage.new_from_base64(base64);
}) }
.toBuffer();
function photonImageToBuffer(image: photon.PhotonImage): Buffer {
const base64 = image.get_base64().replace(/^data:image\/\w+;base64,/, "");
return Buffer.from(base64, "base64");
}
function resizeBuffer(input: Buffer, width: number, height: number): Buffer {
const photonImage = bufferToPhotonImage(input);
photon.resize(photonImage, width, height, photon.SamplingFilter.Lanczos3);
return photonImageToBuffer(photonImage);
} }
const CDN_URL = "https://twemoji.maxcdn.com/2/svg"; const CDN_URL = "https://twemoji.maxcdn.com/2/svg";

View file

@ -1,6 +1,7 @@
import { Util } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendSuccessMessage } from "../../../pluginUtils";
import { errorMessage } from "../../../utils"; import { errorMessage } from "../../../utils";
import { canActOn, sendSuccessMessage } from "../../../pluginUtils";
import { utilityCmd } from "../types"; import { utilityCmd } from "../types";
export const NicknameCmd = utilityCmd({ export const NicknameCmd = utilityCmd({
@ -11,10 +12,19 @@ export const NicknameCmd = utilityCmd({
signature: { signature: {
member: ct.resolvedMember(), member: ct.resolvedMember(),
nickname: ct.string({ catchAll: true }), nickname: ct.string({ catchAll: true, required: false }),
}, },
async run({ message: msg, args, pluginData }) { async run({ message: msg, args, pluginData }) {
if (!args.nickname) {
if (!args.member.nickname) {
msg.channel.send(`<@!${args.member.id}> does not have a nickname`);
} else {
msg.channel.send(`The nickname of <@!${args.member.id}> is **${Util.escapeBold(args.nickname)}**`);
}
return;
}
if (msg.member.id !== args.member.id && !canActOn(pluginData, msg.member, args.member)) { if (msg.member.id !== args.member.id && !canActOn(pluginData, msg.member, args.member)) {
msg.channel.send(errorMessage("Cannot change nickname: insufficient permissions")); msg.channel.send(errorMessage("Cannot change nickname: insufficient permissions"));
return; return;
@ -29,9 +39,7 @@ export const NicknameCmd = utilityCmd({
const oldNickname = args.member.nickname || "<none>"; const oldNickname = args.member.nickname || "<none>";
try { try {
await args.member.edit({ await args.member.setNickname(args.nickname ?? null);
nick: args.nickname,
});
} catch { } catch {
msg.channel.send(errorMessage("Failed to change nickname")); msg.channel.send(errorMessage("Failed to change nickname"));
return; return;

View file

@ -19,10 +19,13 @@ export const NicknameResetCmd = utilityCmd({
return; return;
} }
if (!args.member.nickname) {
msg.channel.send(errorMessage("User does not have a nickname"));
return;
}
try { try {
await args.member.edit({ await args.member.setNickname(null);
nick: "",
});
} catch { } catch {
msg.channel.send(errorMessage("Failed to reset nickname")); msg.channel.send(errorMessage("Failed to reset nickname"));
return; return;

View file

@ -5,7 +5,7 @@ import { utilityCmd } from "../types";
const { performance } = require("perf_hooks"); const { performance } = require("perf_hooks");
export const PingCmd = utilityCmd({ export const PingCmd = utilityCmd({
trigger: "ping", trigger: ["ping", "pong"],
description: "Test the bot's ping to the Discord API", description: "Test the bot's ping to the Discord API",
permission: "can_ping", permission: "can_ping",

View file

@ -32,7 +32,7 @@ export const VcdisconnectCmd = utilityCmd({
const channel = pluginData.guild.channels.cache.get(args.member.voice.channelId) as VoiceChannel; const channel = pluginData.guild.channels.cache.get(args.member.voice.channelId) as VoiceChannel;
try { try {
await args.member.voice.kick(); await args.member.voice.disconnect();
} catch { } catch {
sendErrorMessage(pluginData, msg.channel, "Failed to disconnect member"); sendErrorMessage(pluginData, msg.channel, "Failed to disconnect member");
return; return;

View file

@ -9,6 +9,7 @@ import { LogType } from "../../../data/LogType";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils"; import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { channelMentionRegex, isSnowflake, simpleClosestStringMatch } from "../../../utils"; import { channelMentionRegex, isSnowflake, simpleClosestStringMatch } from "../../../utils";
import { utilityCmd } from "../types"; import { utilityCmd } from "../types";
import { ChannelTypeStrings } from "../../../types";
export const VcmoveCmd = utilityCmd({ export const VcmoveCmd = utilityCmd({
trigger: "vcmove", trigger: "vcmove",
@ -45,9 +46,9 @@ export const VcmoveCmd = utilityCmd({
channel = potentialChannel; channel = potentialChannel;
} else { } else {
// Search string -> find closest matching voice channel name // Search string -> find closest matching voice channel name
const voiceChannels = pluginData.guild.channels.cache.array().filter(theChannel => { const voiceChannels = [...pluginData.guild.channels.cache.values()].filter(
return theChannel instanceof VoiceChannel; (c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE,
}) as VoiceChannel[]; );
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name); const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
if (!closestMatch) { if (!closestMatch) {
sendErrorMessage(pluginData, msg.channel, "No matching voice channels"); sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
@ -124,9 +125,9 @@ export const VcmoveAllCmd = utilityCmd({
channel = potentialChannel; channel = potentialChannel;
} else { } else {
// Search string -> find closest matching voice channel name // Search string -> find closest matching voice channel name
const voiceChannels = pluginData.guild.channels.cache.array().filter(theChannel => { const voiceChannels = [...pluginData.guild.channels.cache.values()].filter(
return theChannel instanceof VoiceChannel; (c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE,
}) as VoiceChannel[]; );
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name); const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
if (!closestMatch) { if (!closestMatch) {
sendErrorMessage(pluginData, msg.channel, "No matching voice channels"); sendErrorMessage(pluginData, msg.channel, "No matching voice channels");

View file

@ -130,11 +130,12 @@ export async function getChannelInfoEmbed(
if (channel.type === ChannelTypeStrings.PRIVATE_THREAD || channel.type === ChannelTypeStrings.PUBLIC_THREAD) { if (channel.type === ChannelTypeStrings.PRIVATE_THREAD || channel.type === ChannelTypeStrings.PUBLIC_THREAD) {
const thread = channel as ThreadChannel; const thread = channel as ThreadChannel;
const parentChannelName = thread.parent?.name ? thread.parent.name : `<#${thread.parentId}>`; const parentChannelName = thread.parent?.name ?? `<#${thread.parentId}>`;
const memberCount = thread.memberCount ?? thread.members.cache.size; const memberCount = thread.memberCount ?? thread.members.cache.size;
const owner = await pluginData.guild.members.fetch(thread.ownerId).catch(() => null); const owner = await thread.fetchOwner().catch(() => null);
const ownerMention = owner ? verboseUserMention(owner.user) : "Unknown#0000"; const ownerMention = owner?.user ? verboseUserMention(owner.user) : "Unknown#0000";
const humanizedArchiveTime = `Archive duration: **${humanizeDuration(thread.autoArchiveDuration * MINUTES)}**`; const autoArchiveDuration = thread.autoArchiveDuration === "MAX" ? 10080 : thread.autoArchiveDuration; // TODO: Boost level check
const humanizedArchiveTime = `Archive duration: **${humanizeDuration((autoArchiveDuration ?? 0) * MINUTES)}**`;
embed.fields.push({ embed.fields.push({
name: preEmbedPadding + "Thread information", name: preEmbedPadding + "Thread information",

View file

@ -0,0 +1,6 @@
const customEmojiRegex = /(?:<a?:[a-z0-9_]{2,32}:)?([1-9]\d+)>?/i;
export function getCustomEmojiId(str: string): string | null {
const emojiIdMatch = str.match(customEmojiRegex);
return emojiIdMatch?.[1] ?? null;
}

View file

@ -27,6 +27,7 @@ export interface ZeppelinGuildPluginBlueprint<TPluginData extends GuildPluginDat
description?: TMarkdown; description?: TMarkdown;
usageGuide?: TMarkdown; usageGuide?: TMarkdown;
configurationGuide?: TMarkdown; configurationGuide?: TMarkdown;
legacy?: boolean;
}; };
configPreprocessor?: ( configPreprocessor?: (

View file

@ -6,6 +6,7 @@ import { CasesPlugin } from "./Cases/CasesPlugin";
import { CensorPlugin } from "./Censor/CensorPlugin"; import { CensorPlugin } from "./Censor/CensorPlugin";
import { ChannelArchiverPlugin } from "./ChannelArchiver/ChannelArchiverPlugin"; import { ChannelArchiverPlugin } from "./ChannelArchiver/ChannelArchiverPlugin";
import { CompanionChannelsPlugin } from "./CompanionChannels/CompanionChannelsPlugin"; import { CompanionChannelsPlugin } from "./CompanionChannels/CompanionChannelsPlugin";
import { ContextMenuPlugin } from "./ContextMenus/ContextMenuPlugin";
import { CountersPlugin } from "./Counters/CountersPlugin"; import { CountersPlugin } from "./Counters/CountersPlugin";
import { CustomEventsPlugin } from "./CustomEvents/CustomEventsPlugin"; import { CustomEventsPlugin } from "./CustomEvents/CustomEventsPlugin";
import { GuildAccessMonitorPlugin } from "./GuildAccessMonitor/GuildAccessMonitorPlugin"; import { GuildAccessMonitorPlugin } from "./GuildAccessMonitor/GuildAccessMonitorPlugin";
@ -67,6 +68,7 @@ export const guildPlugins: Array<ZeppelinGuildPluginBlueprint<any>> = [
CustomEventsPlugin, CustomEventsPlugin,
TimeAndDatePlugin, TimeAndDatePlugin,
CountersPlugin, CountersPlugin,
ContextMenuPlugin,
]; ];
// prettier-ignore // prettier-ignore

View file

@ -49,6 +49,7 @@ export interface ZeppelinPluginInfo {
description?: TMarkdown; description?: TMarkdown;
usageGuide?: TMarkdown; usageGuide?: TMarkdown;
configurationGuide?: TMarkdown; configurationGuide?: TMarkdown;
legacy?: boolean;
} }
export interface CommandInfo { export interface CommandInfo {

View file

@ -8,6 +8,7 @@ import {
GuildChannel, GuildChannel,
GuildMember, GuildMember,
Invite, Invite,
InviteGuild,
LimitedCollection, LimitedCollection,
Message, Message,
MessageAttachment, MessageAttachment,
@ -248,9 +249,8 @@ export function nonNullish<V>(v: V): v is NonNullable<V> {
return v != null; return v != null;
} }
export type InviteOpts = "withMetadata" | "withCount" | "withoutCount"; export type GuildInvite = Invite & { guild: InviteGuild | Guild };
export type GuildInvite<CT extends InviteOpts = "withMetadata"> = Invite & { guild: Guild }; export type GroupDMInvite = Invite & {
export type GroupDMInvite<CT extends InviteOpts = "withMetadata"> = Invite & {
channel: PartialChannelData; channel: PartialChannelData;
type: typeof Constants.ChannelTypes.GROUP_DM; type: typeof Constants.ChannelTypes.GROUP_DM;
}; };
@ -535,7 +535,7 @@ export async function findRelevantAuditLogEntry(
} }
} }
const entries = auditLogs ? auditLogs.entries.array() : []; const entries = auditLogs ? [...auditLogs.entries.values()] : [];
entries.sort((a, b) => { entries.sort((a, b) => {
if (a.createdAt > b.createdAt) return -1; if (a.createdAt > b.createdAt) return -1;
@ -1302,7 +1302,7 @@ export async function resolveInvite<T extends boolean>(
return promise as ResolveInviteReturnType<T>; return promise as ResolveInviteReturnType<T>;
} }
const internalStickerCache: LimitedCollection<Snowflake, Sticker> = new LimitedCollection(500); const internalStickerCache: LimitedCollection<Snowflake, Sticker> = new LimitedCollection({ maxSize: 500 });
export async function resolveStickerId(bot: Client, id: Snowflake): Promise<Sticker | null> { export async function resolveStickerId(bot: Client, id: Snowflake): Promise<Sticker | null> {
const cachedSticker = internalStickerCache.get(id); const cachedSticker = internalStickerCache.get(id);
@ -1480,11 +1480,11 @@ export function isFullMessage(msg: Message | PartialMessage): msg is Message {
return (msg as Message).createdAt != null; return (msg as Message).createdAt != null;
} }
export function isGuildInvite<CT extends InviteOpts>(invite: Invite): invite is GuildInvite<CT> { export function isGuildInvite(invite: Invite): invite is GuildInvite {
return invite.guild != null; return invite.guild != null;
} }
export function isGroupDMInvite<CT extends InviteOpts>(invite: Invite): invite is GroupDMInvite<CT> { export function isGroupDMInvite(invite: Invite): invite is GroupDMInvite {
return invite.guild == null && invite.channel?.type === ChannelTypeStrings.GROUP; return invite.guild == null && invite.channel?.type === ChannelTypeStrings.GROUP;
} }

View file

@ -11,6 +11,7 @@ import {
User, User,
} from "discord.js"; } from "discord.js";
import { UnknownUser } from "src/utils"; import { UnknownUser } from "src/utils";
import { GuildPluginData } from "knub";
export interface IConfigAccessibleUser { export interface IConfigAccessibleUser {
id: Snowflake | string; id: Snowflake | string;
@ -87,7 +88,7 @@ export function memberToConfigAccessibleMember(member: GuildMember | PartialGuil
...user, ...user,
user, user,
nick: member.nickname ?? "*None*", nick: member.nickname ?? "*None*",
roles: member.roles.cache.mapValues(r => roleToConfigAccessibleRole(r)).array(), roles: [...member.roles.cache.mapValues(r => roleToConfigAccessibleRole(r)).values()],
joinedAt: member.joinedTimestamp ?? undefined, joinedAt: member.joinedTimestamp ?? undefined,
guildName: member.guild.name, guildName: member.guild.name,
}; };
@ -180,3 +181,21 @@ export function stickerToConfigAccessibleSticker(sticker: Sticker): IConfigAcces
return toReturn; return toReturn;
} }
export function getConfigAccessibleMemberLevel(
pluginData: GuildPluginData<any>,
member: IConfigAccessibleMember,
): number {
if (member.id === pluginData.guild.ownerId) {
return 99999;
}
const levels = pluginData.fullConfig.levels ?? {};
for (const [id, level] of Object.entries(levels)) {
if (member.id === id || member.roles?.find(r => r.id === id)) {
return level as number;
}
}
return 0;
}

View file

@ -1,4 +1,4 @@
import { Permissions } from "discord.js"; import { Permissions, PermissionString } from "discord.js";
/** /**
* @param resolvedPermissions A Permission object from e.g. GuildChannel#permissionsOf() or Member#permission * @param resolvedPermissions A Permission object from e.g. GuildChannel#permissionsOf() or Member#permission
@ -8,12 +8,14 @@ export function hasDiscordPermissions(
resolvedPermissions: Permissions | Readonly<Permissions> | null, resolvedPermissions: Permissions | Readonly<Permissions> | null,
requiredPermissions: number | bigint, requiredPermissions: number | bigint,
) { ) {
const allowedPermissions = resolvedPermissions; if (resolvedPermissions == null) {
const nRequiredPermissions = requiredPermissions; return false;
}
if (Boolean(allowedPermissions?.bitfield! & Permissions.FLAGS.ADMINISTRATOR)) { if (resolvedPermissions.has(Permissions.FLAGS.ADMINISTRATOR)) {
return true; return true;
} }
return Boolean((allowedPermissions?.bitfield! & BigInt(nRequiredPermissions)) === nRequiredPermissions); const nRequiredPermissions = BigInt(requiredPermissions);
return Boolean((resolvedPermissions?.bitfield! & nRequiredPermissions) === nRequiredPermissions);
} }

20601
dashboard/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -321,7 +321,7 @@
actions: actions:
set_counter: set_counter:
counter: "antiraid_decay" counter: "antiraid_decay"
amount: 10 # "Disable after 10min" value: 10 # "Disable after 10min"
start_antiraid_timer_high: start_antiraid_timer_high:
triggers: triggers:
@ -330,7 +330,7 @@
actions: actions:
set_counter: set_counter:
counter: "antiraid_decay" counter: "antiraid_decay"
amount: 20 # "Disable after 20min" value: 20 # "Disable after 20min"
disable_antiraid_after_timer: disable_antiraid_after_timer:
triggers: triggers:

View file

@ -155,7 +155,14 @@
...menu, ...menu,
{ {
label: 'Plugins', label: 'Plugins',
items: this.plugins.map(plugin => ({ items: this.plugins.filter(plugin => !plugin.info.legacy).map(plugin => ({
label: plugin.info.prettyName || plugin.name,
to: `/docs/plugins/${plugin.name}`,
})),
},
{
label: "Legacy Plugins",
items: this.plugins.filter(plugin => plugin.info.legacy).map(plugin => ({
label: plugin.info.prettyName || plugin.name, label: plugin.info.prettyName || plugin.name,
to: `/docs/plugins/${plugin.name}`, to: `/docs/plugins/${plugin.name}`,
})), })),

View file

@ -6,25 +6,25 @@ updates:
schedule: schedule:
interval: "daily" interval: "daily"
allow: allow:
- dependency-type: "production" - dependency-type: "direct"
- package-ecosystem: "npm" - package-ecosystem: "npm"
directory: "/backend" directory: "/backend"
schedule: schedule:
interval: "daily" interval: "daily"
allow: allow:
- dependency-type: "production" - dependency-type: "direct"
- package-ecosystem: "npm" - package-ecosystem: "npm"
directory: "/shared" directory: "/shared"
schedule: schedule:
interval: "daily" interval: "daily"
allow: allow:
- dependency-type: "production" - dependency-type: "direct"
- package-ecosystem: "npm" - package-ecosystem: "npm"
directory: "/dashboard" directory: "/dashboard"
schedule: schedule:
interval: "daily" interval: "daily"
allow: allow:
- dependency-type: "production" - dependency-type: "direct"

495
package-lock.json generated
View file

@ -7,6 +7,9 @@
"": { "": {
"name": "@zeppelin/zeppelin", "name": "@zeppelin/zeppelin",
"version": "0.0.1", "version": "0.0.1",
"dependencies": {
"knub": "^30.0.0-beta.39"
},
"devDependencies": { "devDependencies": {
"husky": "^3.0.9", "husky": "^3.0.9",
"lint-staged": "^9.4.2", "lint-staged": "^9.4.2",
@ -36,6 +39,48 @@
"js-tokens": "^4.0.0" "js-tokens": "^4.0.0"
} }
}, },
"node_modules/@discordjs/builders": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz",
"integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==",
"dependencies": {
"@sindresorhus/is": "^4.0.1",
"discord-api-types": "^0.22.0",
"ow": "^0.27.0",
"ts-mixer": "^6.0.0",
"tslib": "^2.3.0"
},
"engines": {
"node": ">=14.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@discordjs/builders/node_modules/tslib": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
},
"node_modules/@discordjs/collection": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.2.1.tgz",
"integrity": "sha512-vhxqzzM8gkomw0TYRF3tgx7SwElzUlXT/Aa41O7mOcyN6wIJfj5JmDWaO5XGKsGSsNx7F3i5oIlrucCCWV1Nog==",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@discordjs/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/@nodelib/fs.scandir": { "node_modules/@nodelib/fs.scandir": {
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz",
@ -83,6 +128,26 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/@sapphire/async-queue": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.4.tgz",
"integrity": "sha512-fFrlF/uWpGOX5djw5Mu2Hnnrunao75WGey0sP0J3jnhmrJ5TAPzHYOmytD5iN/+pMxS+f+u/gezqHa9tPhRHEA==",
"engines": {
"node": ">=14",
"npm": ">=6"
}
},
"node_modules/@sindresorhus/is": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz",
"integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sindresorhus/is?sponsor=1"
}
},
"node_modules/@types/events": { "node_modules/@types/events": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz",
@ -109,8 +174,7 @@
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "12.12.5", "version": "12.12.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.5.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.5.tgz",
"integrity": "sha512-KEjODidV4XYUlJBF3XdjSH5FWoMCtO0utnhtdLf1AgeuZLOrRbvmU/gaRCVg7ZaQDjVf3l84egiY0mRNe5xE4A==", "integrity": "sha512-KEjODidV4XYUlJBF3XdjSH5FWoMCtO0utnhtdLf1AgeuZLOrRbvmU/gaRCVg7ZaQDjVf3l84egiY0mRNe5xE4A=="
"dev": true
}, },
"node_modules/@types/normalize-package-data": { "node_modules/@types/normalize-package-data": {
"version": "2.4.0", "version": "2.4.0",
@ -118,6 +182,14 @@
"integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==",
"dev": true "dev": true
}, },
"node_modules/@types/ws": {
"version": "7.4.7",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/aggregate-error": { "node_modules/aggregate-error": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
@ -188,6 +260,11 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -336,6 +413,17 @@
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true "dev": true
}, },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": { "node_modules/commander": {
"version": "2.20.3", "version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
@ -420,6 +508,14 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/diff": { "node_modules/diff": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",
@ -441,6 +537,55 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/discord-api-types": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz",
"integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==",
"engines": {
"node": ">=12"
}
},
"node_modules/discord.js": {
"version": "13.1.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.1.0.tgz",
"integrity": "sha512-gxO4CXKdHpqA+WKG+f5RNnd3srTDj5uFJHgOathksDE90YNq/Qijkd2WlMgTTMS6AJoEnHxI7G9eDQHCuZ+xDA==",
"dependencies": {
"@discordjs/builders": "^0.5.0",
"@discordjs/collection": "^0.2.1",
"@discordjs/form-data": "^3.0.1",
"@sapphire/async-queue": "^1.1.4",
"@types/ws": "^7.4.7",
"discord-api-types": "^0.22.0",
"node-fetch": "^2.6.1",
"ws": "^7.5.1"
},
"engines": {
"node": ">=16.6.0",
"npm": ">=7.0.0"
}
},
"node_modules/dot-prop": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz",
"integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==",
"dependencies": {
"is-obj": "^2.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/dot-prop/node_modules/is-obj": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
"engines": {
"node": ">=8"
}
},
"node_modules/elegant-spinner": { "node_modules/elegant-spinner": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz",
@ -919,6 +1064,33 @@
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
"dev": true "dev": true
}, },
"node_modules/knub": {
"version": "30.0.0-beta.39",
"resolved": "https://registry.npmjs.org/knub/-/knub-30.0.0-beta.39.tgz",
"integrity": "sha512-L9RYkqh7YcWfw0ZXdGrKEZru/J+mkiyn+8vi1xCvjEdKMPdq4Gov/SG4suajMFhhX3RXdvh8BoE/3gbR2cq4xA==",
"dependencies": {
"discord-api-types": "^0.22.0",
"discord.js": "^13.0.1",
"knub-command-manager": "^9.1.0",
"ts-essentials": "^6.0.7"
}
},
"node_modules/knub-command-manager": {
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/knub-command-manager/-/knub-command-manager-9.1.0.tgz",
"integrity": "sha512-pEtpWElbBoTRSL8kWSPRrTIuTIdvYGkP/wzOn77cieumC02adfwEt1Cc09HFvVT4ib35nf1y31oul36csaG7Vg==",
"dependencies": {
"escape-string-regexp": "^2.0.0"
}
},
"node_modules/knub-command-manager/node_modules/escape-string-regexp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",
"integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==",
"engines": {
"node": ">=8"
}
},
"node_modules/lines-and-columns": { "node_modules/lines-and-columns": {
"version": "1.1.6", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
@ -1225,6 +1397,11 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/lodash.isequal": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
"integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
},
"node_modules/log-symbols": { "node_modules/log-symbols": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz",
@ -1279,6 +1456,25 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/mime-db": {
"version": "1.49.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz",
"integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.32",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz",
"integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==",
"dependencies": {
"mime-db": "1.49.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mimic-fn": { "node_modules/mimic-fn": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
@ -1331,6 +1527,14 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true "dev": true
}, },
"node_modules/node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
"engines": {
"node": "4.x || >=6.0.0"
}
},
"node_modules/normalize-package-data": { "node_modules/normalize-package-data": {
"version": "2.5.0", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
@ -1412,6 +1616,44 @@
"opencollective-postinstall": "index.js" "opencollective-postinstall": "index.js"
} }
}, },
"node_modules/ow": {
"version": "0.27.0",
"resolved": "https://registry.npmjs.org/ow/-/ow-0.27.0.tgz",
"integrity": "sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ==",
"dependencies": {
"@sindresorhus/is": "^4.0.1",
"callsites": "^3.1.0",
"dot-prop": "^6.0.1",
"lodash.isequal": "^4.5.0",
"type-fest": "^1.2.1",
"vali-date": "^1.0.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/ow/node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
"engines": {
"node": ">=6"
}
},
"node_modules/ow/node_modules/type-fest": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",
"integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-finally": { "node_modules/p-finally": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
@ -1905,6 +2147,19 @@
"node": ">=8.0" "node": ">=8.0"
} }
}, },
"node_modules/ts-essentials": {
"version": "6.0.7",
"resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-6.0.7.tgz",
"integrity": "sha512-2E4HIIj4tQJlIHuATRHayv0EfMGK3ris/GRk1E3CFnsZzeNV+hUmelbaTZHLtXaZppM5oLhHRtO04gINC4Jusw==",
"peerDependencies": {
"typescript": ">=3.7.0"
}
},
"node_modules/ts-mixer": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
"integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ=="
},
"node_modules/tslib": { "node_modules/tslib": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
@ -1978,7 +2233,6 @@
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz",
"integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==", "integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==",
"dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"
@ -1987,6 +2241,14 @@
"node": ">=4.2.0" "node": ">=4.2.0"
} }
}, },
"node_modules/vali-date": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz",
"integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/validate-npm-package-license": { "node_modules/validate-npm-package-license": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
@ -2070,6 +2332,26 @@
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true "dev": true
},
"node_modules/ws": {
"version": "7.5.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz",
"integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==",
"engines": {
"node": ">=8.3.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
} }
}, },
"dependencies": { "dependencies": {
@ -2093,6 +2375,40 @@
"js-tokens": "^4.0.0" "js-tokens": "^4.0.0"
} }
}, },
"@discordjs/builders": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz",
"integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==",
"requires": {
"@sindresorhus/is": "^4.0.1",
"discord-api-types": "^0.22.0",
"ow": "^0.27.0",
"ts-mixer": "^6.0.0",
"tslib": "^2.3.0"
},
"dependencies": {
"tslib": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
}
}
},
"@discordjs/collection": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.2.1.tgz",
"integrity": "sha512-vhxqzzM8gkomw0TYRF3tgx7SwElzUlXT/Aa41O7mOcyN6wIJfj5JmDWaO5XGKsGSsNx7F3i5oIlrucCCWV1Nog=="
},
"@discordjs/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
},
"@nodelib/fs.scandir": { "@nodelib/fs.scandir": {
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz",
@ -2128,6 +2444,16 @@
"any-observable": "^0.3.0" "any-observable": "^0.3.0"
} }
}, },
"@sapphire/async-queue": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.4.tgz",
"integrity": "sha512-fFrlF/uWpGOX5djw5Mu2Hnnrunao75WGey0sP0J3jnhmrJ5TAPzHYOmytD5iN/+pMxS+f+u/gezqHa9tPhRHEA=="
},
"@sindresorhus/is": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz",
"integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g=="
},
"@types/events": { "@types/events": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz",
@ -2154,8 +2480,7 @@
"@types/node": { "@types/node": {
"version": "12.12.5", "version": "12.12.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.5.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.5.tgz",
"integrity": "sha512-KEjODidV4XYUlJBF3XdjSH5FWoMCtO0utnhtdLf1AgeuZLOrRbvmU/gaRCVg7ZaQDjVf3l84egiY0mRNe5xE4A==", "integrity": "sha512-KEjODidV4XYUlJBF3XdjSH5FWoMCtO0utnhtdLf1AgeuZLOrRbvmU/gaRCVg7ZaQDjVf3l84egiY0mRNe5xE4A=="
"dev": true
}, },
"@types/normalize-package-data": { "@types/normalize-package-data": {
"version": "2.4.0", "version": "2.4.0",
@ -2163,6 +2488,14 @@
"integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==",
"dev": true "dev": true
}, },
"@types/ws": {
"version": "7.4.7",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
"requires": {
"@types/node": "*"
}
},
"aggregate-error": { "aggregate-error": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
@ -2215,6 +2548,11 @@
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
"dev": true "dev": true
}, },
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -2333,6 +2671,14 @@
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true "dev": true
}, },
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"commander": { "commander": {
"version": "2.20.3", "version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
@ -2407,6 +2753,11 @@
"slash": "^3.0.0" "slash": "^3.0.0"
} }
}, },
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
},
"diff": { "diff": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",
@ -2422,6 +2773,41 @@
"path-type": "^4.0.0" "path-type": "^4.0.0"
} }
}, },
"discord-api-types": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz",
"integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg=="
},
"discord.js": {
"version": "13.1.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.1.0.tgz",
"integrity": "sha512-gxO4CXKdHpqA+WKG+f5RNnd3srTDj5uFJHgOathksDE90YNq/Qijkd2WlMgTTMS6AJoEnHxI7G9eDQHCuZ+xDA==",
"requires": {
"@discordjs/builders": "^0.5.0",
"@discordjs/collection": "^0.2.1",
"@discordjs/form-data": "^3.0.1",
"@sapphire/async-queue": "^1.1.4",
"@types/ws": "^7.4.7",
"discord-api-types": "^0.22.0",
"node-fetch": "^2.6.1",
"ws": "^7.5.1"
}
},
"dot-prop": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz",
"integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==",
"requires": {
"is-obj": "^2.0.0"
},
"dependencies": {
"is-obj": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="
}
}
},
"elegant-spinner": { "elegant-spinner": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz",
@ -2795,6 +3181,32 @@
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
"dev": true "dev": true
}, },
"knub": {
"version": "30.0.0-beta.39",
"resolved": "https://registry.npmjs.org/knub/-/knub-30.0.0-beta.39.tgz",
"integrity": "sha512-L9RYkqh7YcWfw0ZXdGrKEZru/J+mkiyn+8vi1xCvjEdKMPdq4Gov/SG4suajMFhhX3RXdvh8BoE/3gbR2cq4xA==",
"requires": {
"discord-api-types": "^0.22.0",
"discord.js": "^13.0.1",
"knub-command-manager": "^9.1.0",
"ts-essentials": "^6.0.7"
}
},
"knub-command-manager": {
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/knub-command-manager/-/knub-command-manager-9.1.0.tgz",
"integrity": "sha512-pEtpWElbBoTRSL8kWSPRrTIuTIdvYGkP/wzOn77cieumC02adfwEt1Cc09HFvVT4ib35nf1y31oul36csaG7Vg==",
"requires": {
"escape-string-regexp": "^2.0.0"
},
"dependencies": {
"escape-string-regexp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",
"integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w=="
}
}
},
"lines-and-columns": { "lines-and-columns": {
"version": "1.1.6", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
@ -3034,6 +3446,11 @@
"p-locate": "^4.1.0" "p-locate": "^4.1.0"
} }
}, },
"lodash.isequal": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
"integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
},
"log-symbols": { "log-symbols": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz",
@ -3076,6 +3493,19 @@
"picomatch": "^2.0.5" "picomatch": "^2.0.5"
} }
}, },
"mime-db": {
"version": "1.49.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz",
"integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA=="
},
"mime-types": {
"version": "2.1.32",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz",
"integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==",
"requires": {
"mime-db": "1.49.0"
}
},
"mimic-fn": { "mimic-fn": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
@ -3120,6 +3550,11 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true "dev": true
}, },
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
},
"normalize-package-data": { "normalize-package-data": {
"version": "2.5.0", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
@ -3183,6 +3618,31 @@
"integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==", "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==",
"dev": true "dev": true
}, },
"ow": {
"version": "0.27.0",
"resolved": "https://registry.npmjs.org/ow/-/ow-0.27.0.tgz",
"integrity": "sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ==",
"requires": {
"@sindresorhus/is": "^4.0.1",
"callsites": "^3.1.0",
"dot-prop": "^6.0.1",
"lodash.isequal": "^4.5.0",
"type-fest": "^1.2.1",
"vali-date": "^1.0.0"
},
"dependencies": {
"callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
},
"type-fest": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",
"integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA=="
}
}
},
"p-finally": { "p-finally": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
@ -3562,6 +4022,17 @@
"is-number": "^7.0.0" "is-number": "^7.0.0"
} }
}, },
"ts-essentials": {
"version": "6.0.7",
"resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-6.0.7.tgz",
"integrity": "sha512-2E4HIIj4tQJlIHuATRHayv0EfMGK3ris/GRk1E3CFnsZzeNV+hUmelbaTZHLtXaZppM5oLhHRtO04gINC4Jusw==",
"requires": {}
},
"ts-mixer": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
"integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ=="
},
"tslib": { "tslib": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
@ -3613,8 +4084,12 @@
"typescript": { "typescript": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz",
"integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==", "integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew=="
"dev": true },
"vali-date": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz",
"integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY="
}, },
"validate-npm-package-license": { "validate-npm-package-license": {
"version": "3.0.4", "version": "3.0.4",
@ -3683,6 +4158,12 @@
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true "dev": true
},
"ws": {
"version": "7.5.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz",
"integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==",
"requires": {}
} }
} }
} }

View file

@ -28,5 +28,7 @@
"git add" "git add"
] ]
}, },
"dependencies": {} "dependencies": {
"knub": "^30.0.0-beta.39"
}
} }