From e55fea33f70664b718f55a78ba1c62f6b259739b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Bl=C3=B6meke?= Date: Mon, 20 May 2019 14:13:31 +0200 Subject: [PATCH] Revert "Lock command V1" This reverts commit 2f89d3ae25a523ee3c372c693cef8009b8d4db03. --- src/plugins/Utility.ts | 40 +++------------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/src/plugins/Utility.ts b/src/plugins/Utility.ts index ea197a2b..607ec4f2 100644 --- a/src/plugins/Utility.ts +++ b/src/plugins/Utility.ts @@ -1,4 +1,4 @@ -import { decorators as d, getCommandSignature, IPluginOptions, ICommandDefinition } from "knub"; +import { decorators as d, getCommandSignature, IPluginOptions, ICommandDefinition, waitForReaction } from "knub"; import { CategoryChannel, Channel, @@ -11,7 +11,6 @@ import { TextChannel, User, VoiceChannel, - Permission, } from "eris"; import { channelMentionRegex, @@ -24,7 +23,9 @@ import { multiSorter, noop, resolveMember, + SECONDS, simpleClosestStringMatch, + sleep, sorter, stripObjectToScalars, successMessage, @@ -76,7 +77,6 @@ interface IUtilityPluginConfig { can_vcmove: boolean; can_help: boolean; can_about: boolean; - can_lock: boolean; } export class UtilityPlugin extends ZeppelinPlugin { @@ -105,7 +105,6 @@ export class UtilityPlugin extends ZeppelinPlugin { can_vcmove: false, can_help: false, can_about: false, - can_lock: false, }, overrides: [ { @@ -129,7 +128,6 @@ export class UtilityPlugin extends ZeppelinPlugin { can_ping: true, can_source: true, can_about: true, - can_lock: true, }, }, ], @@ -1061,36 +1059,4 @@ export class UtilityPlugin extends ZeppelinPlugin { msg.channel.createMessage("Reloading..."); this.knub.reloadGuild(this.guildId); } - - @d.command("lock", "[channel:channel]", { - aliases: ["unlock"], - }) - @d.permission("can_lock") - async lockChannelCmd(msg: Message, args: { channel: GuildChannel & TextChannel }) { - const channel = args.channel || msg.channel; - - if (channel == null || !(channel instanceof GuildChannel) || !(channel instanceof TextChannel)) { - await this.sendErrorMessage(msg.channel, `The channel \`${channel.name}\` cant be locked!`); - return; - } - - const permission = channel.permissionOverwrites.get(this.guildId); - - const everyonePerms = new Permission(permission.allow, permission.deny); - const everyonePermsJson = JSON.stringify(everyonePerms.json); - - if (everyonePerms.has("sendMessages")) { - await channel.editPermission(this.guildId, permission.allow - 2048, permission.deny + 2048, "role"); - this.sendSuccessMessage(msg.channel, `Locked ${channel.mention}`); - return; - } else if (!everyonePermsJson.includes("sendMessages")) { - await channel.editPermission(this.guildId, permission.allow, permission.deny + 2048, "role"); - this.sendSuccessMessage(msg.channel, `Locked ${channel.mention}`); - return; - } else { - await channel.editPermission(this.guildId, permission.allow + 2048, permission.deny - 2048, "role"); - this.sendSuccessMessage(msg.channel, `Unlocked ${channel.mention}`); - return; - } - } }