diff --git a/package-lock.json b/package-lock.json index 3be9d0fb..9b942007 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2880,9 +2880,9 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", - "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.7.tgz", + "integrity": "sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw==", "dev": true, "optional": true, "requires": { @@ -2899,7 +2899,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -2908,7 +2909,7 @@ "optional": true }, "are-we-there-yet": { - "version": "1.1.4", + "version": "1.1.5", "bundled": true, "dev": true, "optional": true, @@ -2920,19 +2921,21 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "chownr": { - "version": "1.0.1", + "version": "1.1.1", "bundled": true, "dev": true, "optional": true @@ -2940,17 +2943,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -2968,7 +2974,7 @@ } }, "deep-extend": { - "version": "0.5.1", + "version": "0.6.0", "bundled": true, "dev": true, "optional": true @@ -3017,7 +3023,7 @@ } }, "glob": { - "version": "7.1.2", + "version": "7.1.3", "bundled": true, "dev": true, "optional": true, @@ -3037,12 +3043,12 @@ "optional": true }, "iconv-lite": { - "version": "0.4.21", + "version": "0.4.24", "bundled": true, "dev": true, "optional": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": ">= 2.1.2 < 3" } }, "ignore-walk": { @@ -3067,7 +3073,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3079,6 +3086,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3093,6 +3101,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3100,19 +3109,21 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { - "version": "2.2.4", + "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.0" } }, "minizlib": { - "version": "1.1.0", + "version": "1.2.1", "bundled": true, "dev": true, "optional": true, @@ -3124,6 +3135,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3135,7 +3147,7 @@ "optional": true }, "needle": { - "version": "2.2.0", + "version": "2.2.4", "bundled": true, "dev": true, "optional": true, @@ -3146,18 +3158,18 @@ } }, "node-pre-gyp": { - "version": "0.10.0", + "version": "0.10.3", "bundled": true, "dev": true, "optional": true, "requires": { "detect-libc": "^1.0.2", "mkdirp": "^0.5.1", - "needle": "^2.2.0", + "needle": "^2.2.1", "nopt": "^4.0.1", "npm-packlist": "^1.1.6", "npmlog": "^4.0.2", - "rc": "^1.1.7", + "rc": "^1.2.7", "rimraf": "^2.6.1", "semver": "^5.3.0", "tar": "^4" @@ -3174,13 +3186,13 @@ } }, "npm-bundled": { - "version": "1.0.3", + "version": "1.0.5", "bundled": true, "dev": true, "optional": true }, "npm-packlist": { - "version": "1.1.10", + "version": "1.2.0", "bundled": true, "dev": true, "optional": true, @@ -3204,7 +3216,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3216,6 +3229,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3255,12 +3269,12 @@ "optional": true }, "rc": { - "version": "1.2.7", + "version": "1.2.8", "bundled": true, "dev": true, "optional": true, "requires": { - "deep-extend": "^0.5.1", + "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" @@ -3290,18 +3304,19 @@ } }, "rimraf": { - "version": "2.6.2", + "version": "2.6.3", "bundled": true, "dev": true, "optional": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { - "version": "5.1.1", + "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3316,7 +3331,7 @@ "optional": true }, "semver": { - "version": "5.5.0", + "version": "5.6.0", "bundled": true, "dev": true, "optional": true @@ -3337,6 +3352,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3356,6 +3372,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3367,17 +3384,17 @@ "optional": true }, "tar": { - "version": "4.4.1", + "version": "4.4.8", "bundled": true, "dev": true, "optional": true, "requires": { - "chownr": "^1.0.1", + "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.2" } }, @@ -3388,23 +3405,25 @@ "optional": true }, "wide-align": { - "version": "1.1.2", + "version": "1.1.3", "bundled": true, "dev": true, "optional": true, "requires": { - "string-width": "^1.0.2" + "string-width": "^1.0.2 || 2" } }, "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { - "version": "3.0.2", + "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -5160,9 +5179,9 @@ "dev": true }, "knub": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/knub/-/knub-18.2.0.tgz", - "integrity": "sha512-FRRNmdA/lKjHdw+89uL+CgBLa4A4b4bpQKSHpvoxEDIMjejd482A7YpZ+4iwqpd6+Ua8C5NPBYtoAZlixT4cyw==", + "version": "19.1.1", + "resolved": "https://registry.npmjs.org/knub/-/knub-19.1.1.tgz", + "integrity": "sha512-TOup9M+vV7Pij3KQE9yuC76mpz0GuJyVi+jvqfeRtDMEGAQc64Z1vtudK1He5xIRS3UdSS1s7emE9pSPnNxbeQ==", "requires": { "escape-string-regexp": "^1.0.5", "lodash.at": "^4.6.0", @@ -5772,9 +5791,9 @@ } }, "nan": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "version": "2.13.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", + "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==", "dev": true, "optional": true }, diff --git a/package.json b/package.json index b7f39555..ada41e80 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "escape-string-regexp": "^1.0.5", "humanize-duration": "^3.15.0", "js-yaml": "^3.13.1", - "knub": "^18.2.0", + "knub": "^19.1.1", "lodash.at": "^4.6.0", "lodash.chunk": "^4.2.0", "lodash.difference": "^4.5.0", diff --git a/src/plugins/AutoReactionsPlugin.ts b/src/plugins/AutoReactionsPlugin.ts index 92eeac8c..e354f842 100644 --- a/src/plugins/AutoReactionsPlugin.ts +++ b/src/plugins/AutoReactionsPlugin.ts @@ -6,11 +6,11 @@ import { Message } from "eris"; import { customEmojiRegex, errorMessage, isEmoji, successMessage } from "../utils"; import { ZeppelinPlugin } from "./ZeppelinPlugin"; -interface IAutoReactionsPluginPermissions { - use: boolean; +interface IAutoReactionsPluginConfig { + can_manage: boolean; } -export class AutoReactionsPlugin extends ZeppelinPlugin { +export class AutoReactionsPlugin extends ZeppelinPlugin { public static pluginName = "auto_reactions"; protected savedMessages: GuildSavedMessages; @@ -18,19 +18,17 @@ export class AutoReactionsPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { - config: {}, - - permissions: { - use: false, + config: { + can_manage: false, }, overrides: [ { level: ">=100", - permissions: { - use: true, + config: { + can_manage: true, }, }, ], @@ -55,7 +53,6 @@ export class AutoReactionsPlugin extends ZeppelinPlugin { owners: [], update_cmd: null, }, - - permissions: {}, }; } diff --git a/src/plugins/Cases.ts b/src/plugins/Cases.ts index 390bfb32..a5a6aaa3 100644 --- a/src/plugins/Cases.ts +++ b/src/plugins/Cases.ts @@ -27,8 +27,6 @@ export class CasesPlugin extends ZeppelinPlugin { log_automatic_actions: true, case_log_channel: null, }, - - permissions: {}, }; } diff --git a/src/plugins/Censor.ts b/src/plugins/Censor.ts index 636d40a9..f20ef449 100644 --- a/src/plugins/Censor.ts +++ b/src/plugins/Censor.ts @@ -1,5 +1,5 @@ -import { decorators as d, IPluginOptions, Plugin } from "knub"; -import { Invite, Message } from "eris"; +import { IPluginOptions } from "knub"; +import { Invite } from "eris"; import escapeStringRegexp from "escape-string-regexp"; import { GuildLogs } from "../data/GuildLogs"; import { LogType } from "../data/LogType"; @@ -62,8 +62,6 @@ export class CensorPlugin extends ZeppelinPlugin { blocked_regex: null, }, - permissions: {}, - overrides: [ { level: ">=50", diff --git a/src/plugins/LogServer.ts b/src/plugins/LogServer.ts index 987062d9..9a94b638 100644 --- a/src/plugins/LogServer.ts +++ b/src/plugins/LogServer.ts @@ -1,5 +1,5 @@ import http, { ServerResponse } from "http"; -import { GlobalPlugin, IPluginOptions } from "knub"; +import { GlobalPlugin, IPluginOptions, logger } from "knub"; import { GuildArchives } from "../data/GuildArchives"; import { sleep } from "../utils"; import moment from "moment-timezone"; @@ -27,8 +27,6 @@ export class LogServerPlugin extends GlobalPlugin { config: { port: DEFAULT_PORT, }, - - permissions: {}, }; } @@ -74,7 +72,7 @@ export class LogServerPlugin extends GlobalPlugin { this.server.on("error", async (err: any) => { if (err.code === "EADDRINUSE" && !retried) { - console.log("Got EADDRINUSE, retrying in 2 sec..."); + logger.info("Got EADDRINUSE, retrying in 2 sec..."); retried = true; await sleep(2000); this.server.listen(port); diff --git a/src/plugins/Logs.ts b/src/plugins/Logs.ts index 1da62a65..6f9dab7a 100644 --- a/src/plugins/Logs.ts +++ b/src/plugins/Logs.ts @@ -1,7 +1,7 @@ -import { decorators as d, IPluginOptions, logger, Plugin } from "knub"; +import { decorators as d, IPluginOptions, logger } from "knub"; import { GuildLogs } from "../data/GuildLogs"; import { LogType } from "../data/LogType"; -import { Channel, Constants as ErisConstants, Member, Message, TextChannel, User } from "eris"; +import { Channel, Constants as ErisConstants, Member, TextChannel, User } from "eris"; import { createChunkedMessage, deactivateMentions, @@ -56,13 +56,11 @@ interface ILogsPluginConfig { [key: string]: string; timestamp: string; }; + + ping_user: boolean; } -interface ILogsPluginPermissions { - pinged: boolean; -} - -export class LogsPlugin extends ZeppelinPlugin { +export class LogsPlugin extends ZeppelinPlugin { public static pluginName = "logs"; protected guildLogs: GuildLogs; @@ -78,7 +76,7 @@ export class LogsPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { config: { channels: {}, @@ -86,17 +84,14 @@ export class LogsPlugin extends ZeppelinPlugin=50", - permissions: { - pinged: false, + config: { + ping_user: false, }, }, ], @@ -178,7 +173,9 @@ export class LogsPlugin extends ZeppelinPlugin (**${user.username}#${user.discriminator}**, \`${user.id}\`)`; } else { diff --git a/src/plugins/MessageSaver.ts b/src/plugins/MessageSaver.ts index ca8a26c2..9f0d5a84 100644 --- a/src/plugins/MessageSaver.ts +++ b/src/plugins/MessageSaver.ts @@ -1,30 +1,28 @@ -import { Plugin, decorators as d, IBasePluginConfig, IPluginOptions } from "knub"; +import { Plugin, decorators as d, IPluginOptions } from "knub"; import { GuildChannel, Message, TextChannel } from "eris"; import { GuildSavedMessages } from "../data/GuildSavedMessages"; import { successMessage } from "../utils"; -interface IMessageSaverPluginPermissions { - manage: boolean; +interface IMessageSaverPluginConfig { + can_manage: boolean; } -export class MessageSaverPlugin extends Plugin { +export class MessageSaverPlugin extends Plugin { public static pluginName = "message_saver"; protected savedMessages: GuildSavedMessages; - getDefaultOptions(): IPluginOptions { + getDefaultOptions(): IPluginOptions { return { - config: {}, - - permissions: { - manage: false, + config: { + can_manage: false, }, overrides: [ { level: ">=100", - permissions: { - manage: true, + config: { + can_manage: true, }, }, ], diff --git a/src/plugins/ModActions.ts b/src/plugins/ModActions.ts index 8cad1c2d..d964c226 100644 --- a/src/plugins/ModActions.ts +++ b/src/plugins/ModActions.ts @@ -62,22 +62,20 @@ interface IModActionsPluginConfig { ban_message: string; alert_on_rejoin: boolean; alert_channel: string; + + can_note: boolean; + can_warn: boolean; + can_mute: boolean; + can_kick: boolean; + can_ban: boolean; + can_view: boolean; + can_addcase: boolean; + can_massban: boolean; + can_hidecase: boolean; + can_act_as_other: boolean; } -interface IModActionsPluginPermissions { - note: boolean; - warn: boolean; - mute: boolean; - kick: boolean; - ban: boolean; - view: boolean; - addcase: boolean; - massban: boolean; - hidecase: boolean; - act_as_other: boolean; -} - -export class ModActionsPlugin extends ZeppelinPlugin { +export class ModActionsPlugin extends ZeppelinPlugin { public static pluginName = "mod_actions"; protected actions: GuildActions; @@ -96,7 +94,7 @@ export class ModActionsPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { config: { dm_on_warn: true, @@ -115,38 +113,37 @@ export class ModActionsPlugin extends ZeppelinPlugin=50", - permissions: { - note: true, - warn: true, - mute: true, - kick: true, - ban: true, - view: true, - addcase: true, + config: { + can_note: true, + can_warn: true, + can_mute: true, + can_kick: true, + can_ban: true, + can_view: true, + can_addcase: true, }, }, { level: ">=100", - permissions: { - massban: true, - hidecase: true, - act_as_other: true, + config: { + can_massban: true, + can_hidecase: true, + can_act_as_other: true, }, }, ], @@ -307,7 +304,7 @@ export class ModActionsPlugin extends ZeppelinPlugin ") - @d.permission("note") + @d.permission("can_note") async updateSpecificCmd(msg: Message, args: { caseNumber: number; note: string }) { const theCase = await this.cases.findByCaseNumber(args.caseNumber); if (!theCase) { @@ -328,7 +325,7 @@ export class ModActionsPlugin extends ZeppelinPlugin") - @d.permission("note") + @d.permission("can_note") async updateLatestCmd(msg: Message, args: { note: string }) { const theCase = await this.cases.findLatestByModId(msg.author.id); if (!theCase) { @@ -346,7 +343,7 @@ export class ModActionsPlugin extends ZeppelinPlugin ") - @d.permission("note") + @d.permission("can_note") async noteCmd(msg: Message, args: any) { const user = await this.bot.users.get(args.userId); const userName = user ? `${user.username}#${user.discriminator}` : "member"; @@ -365,7 +362,7 @@ export class ModActionsPlugin extends ZeppelinPlugin ", { options: [{ name: "mod", type: "member" }], }) - @d.permission("warn") + @d.permission("can_warn") async warnCmd(msg: Message, args: any) { // Make sure we're allowed to warn this member if (!this.canActOn(msg.member, args.member)) { @@ -433,7 +430,7 @@ export class ModActionsPlugin extends ZeppelinPlugin ", " [reason:string$]"], options: [{ name: "mod", type: "member" }], }) - @d.permission("mute") + @d.permission("can_mute") async muteCmd(msg: Message, args: { member: Member; time?: number; reason?: string; mod: Member }) { // Make sure we're allowed to mute this member if (!this.canActOn(msg.member, args.member)) { @@ -566,7 +563,7 @@ export class ModActionsPlugin extends ZeppelinPlugin ", " [reason:string$]"], options: [{ name: "mod", type: "member" }], }) - @d.permission("mute") + @d.permission("can_mute") async unmuteCmd(msg: Message, args: { member: Member; time?: number; reason?: string; mod?: Member }) { // Make sure we're allowed to mute this member if (!this.canActOn(msg.member, args.member)) { @@ -651,7 +648,7 @@ export class ModActionsPlugin extends ZeppelinPlugin [reason:string$]", { options: [{ name: "mod", type: "member" }], }) - @d.permission("kick") + @d.permission("can_kick") async kickCmd(msg, args: { member: Member; reason: string; mod: Member }) { // Make sure we're allowed to kick this member if (!this.canActOn(msg.member, args.member)) { @@ -721,7 +718,7 @@ export class ModActionsPlugin extends ZeppelinPlugin [reason:string$]", { options: [{ name: "mod", type: "member" }], }) - @d.permission("ban") + @d.permission("can_ban") async banCmd(msg, args: { member: Member; reason?: string; mod?: Member }) { // Make sure we're allowed to ban this member if (!this.canActOn(msg.member, args.member)) { @@ -791,7 +788,7 @@ export class ModActionsPlugin extends ZeppelinPlugin [reason:string$]", { options: [{ name: "mod", type: "member" }], }) - @d.permission("ban") + @d.permission("can_ban") async softbanCmd(msg, args) { // Make sure we're allowed to ban this member if (!this.canActOn(msg.member, args.member)) { @@ -849,7 +846,7 @@ export class ModActionsPlugin extends ZeppelinPlugin [reason:string$]", { options: [{ name: "mod", type: "member" }], }) - @d.permission("ban") + @d.permission("can_ban") async unbanCmd(msg: Message, args: { userId: string; reason: string; mod: Member }) { // The moderator who did the action is the message author or, if used, the specified --mod let mod = msg.member; @@ -896,7 +893,7 @@ export class ModActionsPlugin extends ZeppelinPlugin [reason:string$]", { options: [{ name: "mod", type: "member" }], }) - @d.permission("ban") + @d.permission("can_ban") async forcebanCmd(msg: Message, args: any) { // If the user exists as a guild member, make sure we can act on them first const member = this.guild.members.get(args.userId); @@ -948,7 +945,7 @@ export class ModActionsPlugin extends ZeppelinPlugin") - @d.permission("massban") + @d.permission("can_massban") async massbanCmd(msg: Message, args: { userIds: string[] }) { // Limit to 100 users at once (arbitrary?) if (args.userIds.length > 100) { @@ -1031,7 +1028,7 @@ export class ModActionsPlugin extends ZeppelinPlugin [reason:string$]", { options: [{ name: "mod", type: "member" }], }) - @d.permission("addcase") + @d.permission("can_addcase") async addcaseCmd(msg: Message, args: { type: string; target: string; reason?: string; mod?: Member }) { // Verify the user id is a valid snowflake-ish if (!args.target.match(/^[0-9]{17,20}$/)) { @@ -1099,7 +1096,7 @@ export class ModActionsPlugin extends ZeppelinPlugin") - @d.permission("view") + @d.permission("can_view") async showCaseCmd(msg: Message, args: { caseNumber: number }) { // Assume case id const theCase = await this.cases.findByCaseNumber(args.caseNumber); @@ -1116,7 +1113,7 @@ export class ModActionsPlugin extends ZeppelinPlugin [opts:string$]") - @d.permission("view") + @d.permission("can_view") async userCasesCmd(msg: Message, args: { userId: string; opts?: string }) { const cases = await this.cases.with("notes").getByUserId(args.userId); const normalCases = cases.filter(c => !c.is_hidden); @@ -1177,7 +1174,7 @@ export class ModActionsPlugin extends ZeppelinPlugin") - @d.permission("hidecase") + @d.permission("can_hidecase") async hideCaseCmd(msg: Message, args: { caseNum: number }) { const theCase = await this.cases.findByCaseNumber(args.caseNum); if (!theCase) { @@ -1217,7 +1214,7 @@ export class ModActionsPlugin extends ZeppelinPlugin") - @d.permission("hidecase") + @d.permission("can_hidecase") async unhideCaseCmd(msg: Message, args: { caseNum: number }) { const theCase = await this.cases.findByCaseNumber(args.caseNum); if (!theCase) { diff --git a/src/plugins/Mutes.ts b/src/plugins/Mutes.ts index f99e31fa..0e6c1c43 100644 --- a/src/plugins/Mutes.ts +++ b/src/plugins/Mutes.ts @@ -13,14 +13,12 @@ import { decorators as d, IPluginOptions, logger } from "knub"; interface IMutesPluginConfig { mute_role: string; move_to_voice_channel: string; + + can_view_list: boolean; + can_cleanup: boolean; } -interface IMutesPluginPermissions { - view_list: boolean; - cleanup: boolean; -} - -export class MutesPlugin extends ZeppelinPlugin { +export class MutesPlugin extends ZeppelinPlugin { public static pluginName = "mutes"; protected actions: GuildActions; @@ -29,27 +27,26 @@ export class MutesPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { config: { mute_role: null, move_to_voice_channel: null, - }, - permissions: { - view_list: false, - cleanup: false, + + can_view_list: false, + can_cleanup: false, }, overrides: [ { level: ">=50", - permissions: { - view_list: true, + config: { + can_view_list: true, }, }, { level: ">=100", - permissions: { - cleanup: true, + config: { + can_cleanup: true, }, }, ], @@ -118,7 +115,7 @@ export class MutesPlugin extends ZeppelinPlugin") - @d.permission("cleanup") + @d.permission("can_cleanup") async clearMuteCmd(msg: Message, args: { userId: string }) { const mute = await this.mutes.findExistingMuteForUserId(args.userId); if (!mute) { diff --git a/src/plugins/NameHistory.ts b/src/plugins/NameHistory.ts index 1ec45a84..16e580e8 100644 --- a/src/plugins/NameHistory.ts +++ b/src/plugins/NameHistory.ts @@ -1,32 +1,30 @@ -import { decorators as d, IBasePluginConfig, IPluginOptions } from "knub"; +import { decorators as d, IPluginOptions } from "knub"; import { GuildNameHistory } from "../data/GuildNameHistory"; import { Member, Message, User } from "eris"; import { NameHistoryEntryTypes } from "../data/NameHistoryEntryTypes"; import { createChunkedMessage, errorMessage, trimLines } from "../utils"; import { ZeppelinPlugin } from "./ZeppelinPlugin"; -interface INameHistoryPluginPermissions { - view: boolean; +interface INameHistoryPluginConfig { + can_view: boolean; } -export class NameHistoryPlugin extends ZeppelinPlugin { +export class NameHistoryPlugin extends ZeppelinPlugin { public static pluginName = "name_history"; protected nameHistory: GuildNameHistory; - getDefaultOptions(): IPluginOptions { + getDefaultOptions(): IPluginOptions { return { - config: {}, - - permissions: { - view: false, + config: { + can_view: false, }, overrides: [ { level: ">=50", - permissions: { - view: true, + config: { + can_view: true, }, }, ], @@ -38,7 +36,7 @@ export class NameHistoryPlugin extends ZeppelinPlugin") - @d.permission("view") + @d.permission("can_view") async namesCmd(msg: Message, args: { userId: string }) { const names = await this.nameHistory.getByUserId(args.userId); if (!names) { diff --git a/src/plugins/Persist.ts b/src/plugins/Persist.ts index 797e9239..7f0f8498 100644 --- a/src/plugins/Persist.ts +++ b/src/plugins/Persist.ts @@ -26,8 +26,6 @@ export class PersistPlugin extends ZeppelinPlugin { persist_nicknames: false, persist_voice_mutes: false, }, - - permissions: {}, }; } diff --git a/src/plugins/PingableRolesPlugin.ts b/src/plugins/PingableRolesPlugin.ts index a60f02b3..3fa093de 100644 --- a/src/plugins/PingableRolesPlugin.ts +++ b/src/plugins/PingableRolesPlugin.ts @@ -1,5 +1,5 @@ -import { decorators as d, IBasePluginConfig, IPluginOptions } from "knub"; -import { Message, Role, TextableChannel, User } from "eris"; +import { decorators as d, IPluginOptions } from "knub"; +import { Message, Role, TextableChannel } from "eris"; import { GuildPingableRoles } from "../data/GuildPingableRoles"; import { PingableRole } from "../data/entities/PingableRole"; import { errorMessage, successMessage } from "../utils"; @@ -7,30 +7,28 @@ import { ZeppelinPlugin } from "./ZeppelinPlugin"; const TIMEOUT = 10 * 1000; -interface IPingableRolesPluginPermissions { - use: boolean; +interface IPingableRolesPluginConfig { + can_manage: boolean; } -export class PingableRolesPlugin extends ZeppelinPlugin { +export class PingableRolesPlugin extends ZeppelinPlugin { public static pluginName = "pingable_roles"; protected pingableRoles: GuildPingableRoles; protected cache: Map; protected timeouts: Map; - getDefaultOptions(): IPluginOptions { + getDefaultOptions(): IPluginOptions { return { - config: {}, - - permissions: { - use: false, + config: { + can_manage: false, }, overrides: [ { level: ">=100", - permissions: { - use: true, + config: { + can_manage: true, }, }, ], @@ -53,7 +51,7 @@ export class PingableRolesPlugin extends ZeppelinPlugin ") - @d.permission("use") + @d.permission("can_manage") async disablePingableRoleCmd(msg: Message, args: { channelId: string; role: Role }) { const pingableRole = await this.pingableRoles.getByChannelAndRoleId(args.channelId, args.role.id); if (!pingableRole) { @@ -70,7 +68,7 @@ export class PingableRolesPlugin extends ZeppelinPlugin ") - @d.permission("use") + @d.permission("can_manage") async setPingableRoleCmd(msg: Message, args: { channelId: string; role: Role }) { const existingPingableRole = await this.pingableRoles.getByChannelAndRoleId(args.channelId, args.role.id); if (existingPingableRole) { @@ -87,7 +85,7 @@ export class PingableRolesPlugin extends ZeppelinPlugin { +export class PostPlugin extends ZeppelinPlugin { public static pluginName = "post"; protected savedMessages: GuildSavedMessages; @@ -23,21 +22,17 @@ export class PostPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { - config: {}, - - permissions: { - post: false, - edit: false, + config: { + can_post: false, }, overrides: [ { level: ">=100", - permissions: { - post: true, - edit: true, + config: { + can_post: true, }, }, ], @@ -59,7 +54,7 @@ export class PostPlugin extends ZeppelinPlugin ") - @d.permission("edit") + @d.permission("can_post") async editCmd(msg, args: { messageId: string; content: string }) { const savedMessage = await this.savedMessages.find(args.messageId); if (!savedMessage) { @@ -185,7 +180,7 @@ export class PostPlugin extends ZeppelinPlugin { +export class ReactionRolesPlugin extends ZeppelinPlugin { public static pluginName = "reaction_roles"; protected reactionRoles: GuildReactionRoles; @@ -46,22 +43,19 @@ export class ReactionRolesPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { config: { auto_refresh_interval: null, - }, - permissions: { - manage: false, - fallback_command: false, + can_manage: false, }, overrides: [ { level: ">=100", - permissions: { - manage: true, + config: { + can_manage: true, }, }, ], @@ -195,7 +189,7 @@ export class ReactionRolesPlugin extends ZeppelinPlugin") - @d.permission("manage") + @d.permission("can_manage") async clearReactionRolesCmd(msg: Message, args: { messageId: string }) { const savedMessage = await this.savedMessages.find(args.messageId); if (!savedMessage) { @@ -222,7 +216,7 @@ export class ReactionRolesPlugin extends ZeppelinPlugin") - @d.permission("manage") + @d.permission("can_manage") async refreshReactionRolesCmd(msg: Message, args: { messageId: string }) { const savedMessage = await this.savedMessages.find(args.messageId); if (!savedMessage) { @@ -247,7 +241,7 @@ export class ReactionRolesPlugin extends ZeppelinPlugin ") - @d.permission("manage") + @d.permission("can_manage") async reactionRolesCmd(msg: Message, args: { messageId: string; reactionRolePairs: string }) { const savedMessage = await this.savedMessages.find(args.messageId); if (!savedMessage) { diff --git a/src/plugins/Reminders.ts b/src/plugins/Reminders.ts index acd3f160..dbd8a19b 100644 --- a/src/plugins/Reminders.ts +++ b/src/plugins/Reminders.ts @@ -1,4 +1,4 @@ -import { decorators as d, IBasePluginConfig, IPluginOptions } from "knub"; +import { decorators as d, IPluginOptions } from "knub"; import { ZeppelinPlugin } from "./ZeppelinPlugin"; import { GuildReminders } from "../data/GuildReminders"; import { Message, TextChannel } from "eris"; @@ -9,11 +9,11 @@ import { convertDelayStringToMS, createChunkedMessage, errorMessage, sorter, suc const REMINDER_LOOP_TIME = 10 * 1000; const MAX_TRIES = 3; -interface IRemindersPluginPermissions { - use: boolean; +interface IRemindersPluginConfig { + can_use: boolean; } -export class RemindersPlugin extends ZeppelinPlugin { +export class RemindersPlugin extends ZeppelinPlugin { public static pluginName = "reminders"; protected reminders: GuildReminders; @@ -21,19 +21,17 @@ export class RemindersPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { - config: {}, - - permissions: { - use: false, + config: { + can_use: false, }, overrides: [ { level: ">=50", - permissions: { - use: true, + config: { + can_use: true, }, }, ], @@ -72,7 +70,7 @@ export class RemindersPlugin extends ZeppelinPlugin ") @d.command("remindme", " ") - @d.permission("use") + @d.permission("can_use") async addReminderCmd(msg: Message, args: { time: string; reminder: string }) { const now = moment(); @@ -115,7 +113,7 @@ export class RemindersPlugin extends ZeppelinPlugin") @d.command("reminders d", "") - @d.permission("use") + @d.permission("can_use") async deleteReminderCmd(msg: Message, args: { num: number }) { const reminders = await this.reminders.getRemindersByUserId(msg.author.id); reminders.sort(sorter("remind_at")); diff --git a/src/plugins/SelfGrantableRolesPlugin.ts b/src/plugins/SelfGrantableRolesPlugin.ts index 17b8f2f8..4fd1a189 100644 --- a/src/plugins/SelfGrantableRolesPlugin.ts +++ b/src/plugins/SelfGrantableRolesPlugin.ts @@ -1,41 +1,39 @@ -import { Plugin, decorators as d, IBasePluginConfig, IPluginOptions } from "knub"; +import { decorators as d, IPluginOptions } from "knub"; import { GuildSelfGrantableRoles } from "../data/GuildSelfGrantableRoles"; import { GuildChannel, Message, Role, TextChannel } from "eris"; import { asSingleLine, chunkArray, errorMessage, sorter, successMessage, trimLines } from "../utils"; import { ZeppelinPlugin } from "./ZeppelinPlugin"; -interface ISelfGrantableRolesPluginPermissions { - manage: boolean; - use: boolean; - ignore_cooldown: boolean; +interface ISelfGrantableRolesPluginConfig { + can_manage: boolean; + can_use: boolean; + can_ignore_cooldown: boolean; } -export class SelfGrantableRolesPlugin extends ZeppelinPlugin { +export class SelfGrantableRolesPlugin extends ZeppelinPlugin { public static pluginName = "self_grantable_roles"; protected selfGrantableRoles: GuildSelfGrantableRoles; - getDefaultOptions(): IPluginOptions { + getDefaultOptions(): IPluginOptions { return { - config: {}, - - permissions: { - manage: false, - use: false, - ignore_cooldown: false, + config: { + can_manage: false, + can_use: false, + can_ignore_cooldown: false, }, overrides: [ { level: ">=50", - permissions: { - ignore_cooldown: true, + config: { + can_ignore_cooldown: true, }, }, { level: ">=100", - permissions: { - manage: true, + config: { + can_manage: true, }, }, ], @@ -47,8 +45,8 @@ export class SelfGrantableRolesPlugin extends ZeppelinPlugin") - @d.permission("use") - @d.cooldown(2500, "ignore_cooldown") + @d.permission("can_use") + @d.cooldown(2500, "can_ignore_cooldown") async roleRemoveCmd(msg: Message, args: { roleNames: string[] }) { const lock = await this.locks.acquire(`grantableRoles:${msg.author.id}`); @@ -131,8 +129,8 @@ export class SelfGrantableRolesPlugin extends ZeppelinPlugin") - @d.permission("use") - @d.cooldown(1500, "ignore_cooldown") + @d.permission("can_use") + @d.cooldown(1500, "can_ignore_cooldown") async roleCmd(msg: Message, args: { roleNames: string[] }) { const lock = await this.locks.acquire(`grantableRoles:${msg.author.id}`); @@ -218,7 +216,7 @@ export class SelfGrantableRolesPlugin extends ZeppelinPlugin [aliases:string...]") - @d.permission("manage") + @d.permission("can_manage") async addSelfGrantableRoleCmd(msg: Message, args: { channel: GuildChannel; roleId: string; aliases?: string[] }) { if (!(args.channel instanceof TextChannel)) { msg.channel.createMessage(errorMessage("Invalid channel (must be a text channel)")); @@ -285,7 +283,7 @@ export class SelfGrantableRolesPlugin extends ZeppelinPlugin ") - @d.permission("manage") + @d.permission("can_manage") async deleteSelfGrantableRoleCmd(msg: Message, args: { channel: GuildChannel; roleId: string }) { await this.selfGrantableRoles.delete(args.channel.id, args.roleId); @@ -297,7 +295,7 @@ export class SelfGrantableRolesPlugin extends ZeppelinPlugin") - @d.permission("manage") + @d.permission("can_manage") async selfGrantableRolesCmd(msg: Message, args: { channel: GuildChannel }) { if (!(args.channel instanceof TextChannel)) { msg.channel.createMessage(errorMessage("Invalid channel (must be a text channel)")); diff --git a/src/plugins/Slowmode.ts b/src/plugins/Slowmode.ts index 5745a653..31f5d7e8 100644 --- a/src/plugins/Slowmode.ts +++ b/src/plugins/Slowmode.ts @@ -9,14 +9,12 @@ import { GuildSavedMessages } from "../data/GuildSavedMessages"; interface ISlowmodePluginConfig { use_native_slowmode: boolean; + + can_manage: boolean; + is_affected: boolean; } -interface ISlowmodePluginPermissions { - manage: boolean; - affected: boolean; -} - -export class SlowmodePlugin extends ZeppelinPlugin { +export class SlowmodePlugin extends ZeppelinPlugin { public static pluginName = "slowmode"; protected slowmodes: GuildSlowmodes; @@ -25,23 +23,21 @@ export class SlowmodePlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { config: { use_native_slowmode: true, - }, - permissions: { - manage: false, - affected: true, + can_manage: false, + is_affected: true, }, overrides: [ { level: ">=50", - permissions: { - manage: true, - affected: false, + config: { + can_manage: true, + is_affected: false, }, }, ], @@ -128,7 +124,7 @@ export class SlowmodePlugin extends ZeppelinPlugin") - @d.permission("manage") + @d.permission("can_manage") async disableSlowmodeCmd(msg: Message, args: { channel: GuildChannel & TextChannel }) { const botSlowmode = await this.slowmodes.getChannelSlowmode(args.channel.id); const hasNativeSlowmode = args.channel.rateLimitPerUser; @@ -168,7 +164,7 @@ export class SlowmodePlugin extends ZeppelinPlugin ") - @d.permission("manage") + @d.permission("can_manage") async clearSlowmodeCmd(msg: Message, args: { channel: GuildChannel & TextChannel; user: User }) { const channelSlowmode = await this.slowmodes.getChannelSlowmode(args.channel.id); if (!channelSlowmode) { @@ -185,7 +181,7 @@ export class SlowmodePlugin extends ZeppelinPlugin = []; @@ -227,7 +223,7 @@ export class SlowmodePlugin extends ZeppelinPlugin ") @d.command("slowmode", "") - @d.permission("manage") + @d.permission("can_manage") async slowmodeCmd(msg: Message, args: { channel?: GuildChannel & TextChannel; time: string }) { const channel = args.channel || msg.channel; diff --git a/src/plugins/Spam.ts b/src/plugins/Spam.ts index c997ac92..9164dee3 100644 --- a/src/plugins/Spam.ts +++ b/src/plugins/Spam.ts @@ -106,8 +106,6 @@ export class SpamPlugin extends ZeppelinPlugin { max_voice_moves: null, }, - permissions: {}, - // Default override to make mods immune to the spam filter overrides: [ { diff --git a/src/plugins/Starboard.ts b/src/plugins/Starboard.ts index e8e80390..b5085dfc 100644 --- a/src/plugins/Starboard.ts +++ b/src/plugins/Starboard.ts @@ -17,11 +17,11 @@ import moment from "moment-timezone"; import { GuildSavedMessages } from "../data/GuildSavedMessages"; import { SavedMessage } from "../data/entities/SavedMessage"; -interface IStarboardPluginPermissions { - manage: boolean; +interface IStarboardPluginConfig { + can_manage: boolean; } -export class StarboardPlugin extends ZeppelinPlugin { +export class StarboardPlugin extends ZeppelinPlugin { public static pluginName = "starboard"; protected starboards: GuildStarboards; @@ -29,19 +29,17 @@ export class StarboardPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { - config: {}, - - permissions: { - manage: false, + config: { + can_manage: false, }, overrides: [ { level: ">=100", - permissions: { - manage: true, + config: { + can_manage: true, }, }, ], @@ -64,7 +62,7 @@ export class StarboardPlugin extends ZeppelinPlugin msg.channel.createMessage("Cancelled"); @@ -177,7 +175,7 @@ export class StarboardPlugin extends ZeppelinPlugin") - @d.permission("manage") + @d.permission("can_manage") async deleteCmd(msg: Message, args: { channelId: string }) { const starboard = await this.starboards.getStarboardByChannelId(args.channelId); if (!starboard) { diff --git a/src/plugins/Tags.ts b/src/plugins/Tags.ts index 7cdfa151..99666174 100644 --- a/src/plugins/Tags.ts +++ b/src/plugins/Tags.ts @@ -13,15 +13,13 @@ import { GuildArchives } from "../data/GuildArchives"; interface ITagsPluginConfig { prefix: string; delete_with_command: boolean; + + can_create: boolean; + can_use: boolean; + can_list: boolean; } -interface ITagsPluginPermissions { - create: boolean; - use: boolean; - list: boolean; -} - -export class TagsPlugin extends ZeppelinPlugin { +export class TagsPlugin extends ZeppelinPlugin { public static pluginName = "tags"; protected archives: GuildArchives; @@ -33,25 +31,23 @@ export class TagsPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { config: { prefix: "!!", delete_with_command: true, - }, - permissions: { - create: false, - use: true, - list: false, + can_create: false, + can_use: true, + can_list: false, }, overrides: [ { level: ">=50", - permissions: { - create: true, - list: true, + config: { + can_create: true, + can_list: true, }, }, ], @@ -109,7 +105,7 @@ export class TagsPlugin extends ZeppelinPlugin") - @d.permission("create") + @d.permission("can_create") async deleteTagCmd(msg: Message, args: { tag: string }) { const tag = await this.tags.find(args.tag); if (!tag) { @@ -138,14 +134,14 @@ export class TagsPlugin extends ZeppelinPlugin") - @d.permission("create") + @d.permission("can_create") async evalTagCmd(msg: Message, args: { body: string }) { const rendered = await this.renderTag(args.body); msg.channel.createMessage(rendered); } @d.command("tag", " ") - @d.permission("create") + @d.permission("can_create") async tagCmd(msg: Message, args: { tag: string; body: string }) { try { parseTemplate(args.body); diff --git a/src/plugins/Utility.ts b/src/plugins/Utility.ts index eb5932ea..98198be0 100644 --- a/src/plugins/Utility.ts +++ b/src/plugins/Utility.ts @@ -1,4 +1,4 @@ -import { decorators as d, IBasePluginConfig, IPluginOptions } from "knub"; +import { decorators as d, IPluginOptions } from "knub"; import { CategoryChannel, Channel, EmbedOptions, Member, Message, Role, TextChannel, User, VoiceChannel } from "eris"; import { channelMentionRegex, @@ -33,21 +33,21 @@ const CLEAN_COMMAND_DELETE_DELAY = 5000; const activeReloads: Map = new Map(); -interface IUtilityPluginPermissions { - roles: boolean; - level: boolean; - search: boolean; - clean: boolean; - info: boolean; - server: boolean; - reload_guild: boolean; - nickname: boolean; - ping: boolean; - source: boolean; - vcmove: boolean; +interface IUtilityPluginConfig { + can_roles: boolean; + can_level: boolean; + can_search: boolean; + can_clean: boolean; + can_info: boolean; + can_server: boolean; + can_reload_guild: boolean; + can_nickname: boolean; + can_ping: boolean; + can_source: boolean; + can_vcmove: boolean; } -export class UtilityPlugin extends ZeppelinPlugin { +export class UtilityPlugin extends ZeppelinPlugin { public static pluginName = "utility"; protected logs: GuildLogs; @@ -55,43 +55,41 @@ export class UtilityPlugin extends ZeppelinPlugin { + getDefaultOptions(): IPluginOptions { return { - config: {}, - - permissions: { - roles: false, - level: false, - search: false, - clean: false, - info: false, - server: false, - reload_guild: false, - nickname: false, - ping: false, - source: false, - vcmove: false, + config: { + can_roles: false, + can_level: false, + can_search: false, + can_clean: false, + can_info: false, + can_server: false, + can_reload_guild: false, + can_nickname: false, + can_ping: false, + can_source: false, + can_vcmove: false, }, overrides: [ { level: ">=50", - permissions: { - roles: true, - level: true, - search: true, - clean: true, - info: true, - server: true, - nickname: true, - vcmove: true, + config: { + can_roles: true, + can_level: true, + can_search: true, + can_clean: true, + can_info: true, + can_server: true, + can_nickname: true, + can_vcmove: true, }, }, { level: ">=100", - permissions: { - reload_guild: true, - ping: true, - source: true, + config: { + can_reload_guild: true, + can_ping: true, + can_source: true, }, }, ], @@ -118,7 +116,7 @@ export class UtilityPlugin extends ZeppelinPlugin = Array.from((msg.channel as TextChannel).guild.roles.values()); if (args.search) { @@ -185,7 +183,7 @@ export class UtilityPlugin extends ZeppelinPlugin") @d.command("clean all", "") - @d.permission("clean") + @d.permission("can_clean") async cleanAllCmd(msg: Message, args: { count: number }) { if (args.count > MAX_CLEAN_COUNT || args.count <= 0) { msg.channel.createMessage(errorMessage(`Clean count must be between 1 and ${MAX_CLEAN_COUNT}`)); @@ -350,7 +348,7 @@ export class UtilityPlugin extends ZeppelinPlugin ") - @d.permission("clean") + @d.permission("can_clean") async cleanUserCmd(msg: Message, args: { userId: string; count: number }) { if (args.count > MAX_CLEAN_COUNT || args.count <= 0) { msg.channel.createMessage(errorMessage(`Clean count must be between 1 and ${MAX_CLEAN_COUNT}`)); @@ -373,7 +371,7 @@ export class UtilityPlugin extends ZeppelinPlugin") - @d.permission("clean") + @d.permission("can_clean") async cleanBotCmd(msg: Message, args: { count: number }) { if (args.count > MAX_CLEAN_COUNT || args.count <= 0) { msg.channel.createMessage(errorMessage(`Clean count must be between 1 and ${MAX_CLEAN_COUNT}`)); @@ -396,7 +394,7 @@ export class UtilityPlugin extends ZeppelinPlugin") - @d.permission("info") + @d.permission("can_info") async infoCmd(msg: Message, args: { userId: string }) { const embed: EmbedOptions = { fields: [], @@ -484,7 +482,7 @@ export class UtilityPlugin extends ZeppelinPlugin") - @d.permission("nickname") + @d.permission("can_nickname") async nicknameResetCmd(msg: Message, args: { target: Member; nickname: string }) { if (msg.member.id !== args.target.id && !this.canActOn(msg.member, args.target)) { msg.channel.createMessage(errorMessage("Cannot reset nickname: insufficient permissions")); @@ -504,7 +502,7 @@ export class UtilityPlugin extends ZeppelinPlugin ") - @d.permission("nickname") + @d.permission("can_nickname") async nicknameCmd(msg: Message, args: { target: Member; nickname: string }) { if (msg.member.id !== args.target.id && !this.canActOn(msg.member, args.target)) { msg.channel.createMessage(errorMessage("Cannot change nickname: insufficient permissions")); @@ -530,7 +528,7 @@ export class UtilityPlugin extends ZeppelinPlugin") - @d.permission("source") + @d.permission("can_source") async sourceCmd(msg: Message, args: { messageId: string }) { const savedMessage = await this.savedMessages.find(args.messageId); if (!savedMessage) { @@ -656,7 +654,7 @@ export class UtilityPlugin extends ZeppelinPlugin ") - @d.permission("vcmove") + @d.permission("can_vcmove") async vcmoveCmd(msg: Message, args: { member: Member; channel: string }) { let channel: VoiceChannel; @@ -727,7 +725,7 @@ export class UtilityPlugin extends ZeppelinPlugin extends Plugin { +export class ZeppelinPlugin extends Plugin { protected configSchema: any; protected permissionsSchema: any; @@ -45,26 +42,6 @@ export class ZeppelinPlugin< } } - // Validate permission values - if (this.permissionsSchema) { - const ajv = new Ajv(); - const validate = ajv.compile(this.permissionsSchema); - - if (options.permissions) { - const isValid = validate(options.permissions); - if (!isValid) return validate.errors; - } - - if (options.overrides) { - for (const override of options.overrides) { - if (override.permissions) { - const isValid = validate(override.permissions); - if (!isValid) return validate.errors; - } - } - } - } - // No errors, return null return null; }