From 69b669956eda3ebafcefd6db79ba462fb5b5fa57 Mon Sep 17 00:00:00 2001 From: DJj123dj <80536295+DJj123dj@users.noreply.github.com> Date: Sat, 1 Oct 2022 12:08:42 +0200 Subject: [PATCH] 3.0 public beta 3 --- commands/add.js | 5 +++-- commands/close.js | 5 +++-- commands/delete.js | 5 +++-- commands/help.js | 5 +++-- commands/remove.js | 5 +++-- commands/rename.js | 5 +++-- commands/reopen.js | 5 +++-- commands/ticket.js | 5 +++-- core/api/api.json | 7 ++++--- core/checker.js | 4 +++- core/ticketActions/ticketCloser.js | 4 ++-- index.js | 2 +- 12 files changed, 34 insertions(+), 23 deletions(-) diff --git a/commands/add.js b/commands/add.js index fb02c24..f88c28a 100644 --- a/commands/add.js +++ b/commands/add.js @@ -7,11 +7,12 @@ const l = bot.language const permsChecker = require("../core/utils/permisssionChecker") const APIEvents = require("../core/api/modules/events") +const DISABLE = require("../core/api/api.json").disable module.exports = () => { bot.errorLog.log("debug","COMMANDS: loaded add.js") - client.on("messageCreate",msg => { + if (!DISABLE.commands.text.add) client.on("messageCreate",msg => { if (!msg.content.startsWith(config.prefix+"add")) return var user = msg.mentions.users.first() if (!user) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" ``:\n`"+config.prefix+"add `")]}) @@ -43,7 +44,7 @@ module.exports = () => { }) - client.on("interactionCreate",(interaction) => { + if (!DISABLE.commands.slash.add) client.on("interactionCreate",(interaction) => { if (!interaction.isChatInputCommand()) return if (interaction.commandName != "add") return const user = interaction.options.getUser("user") diff --git a/commands/close.js b/commands/close.js index 8db6a07..15d36f9 100644 --- a/commands/close.js +++ b/commands/close.js @@ -7,11 +7,12 @@ const l = bot.language const permsChecker = require("../core/utils/permisssionChecker") const APIEvents = require("../core/api/modules/events") +const DISABLE = require("../core/api/api.json").disable module.exports = () => { bot.errorLog.log("debug","COMMANDS: loaded close.js") - client.on("messageCreate",msg => { + if (!DISABLE.commands.text.close) client.on("messageCreate",msg => { if (!msg.content.startsWith(config.prefix+"close")) return const args = msg.content.substring((config.prefix+"close").length).split(" ") @@ -53,7 +54,7 @@ module.exports = () => { }) - client.on("interactionCreate",(interaction) => { + if (!DISABLE.commands.slash.close) client.on("interactionCreate",(interaction) => { if (!interaction.isChatInputCommand()) return if (interaction.commandName != "close") return diff --git a/commands/delete.js b/commands/delete.js index 441485a..4b5f5b1 100644 --- a/commands/delete.js +++ b/commands/delete.js @@ -7,11 +7,12 @@ const l = bot.language const permsChecker = require("../core/utils/permisssionChecker") const APIEvents = require("../core/api/modules/events") +const DISABLE = require("../core/api/api.json").disable module.exports = () => { bot.errorLog.log("debug","COMMANDS: loaded delete.js") - client.on("messageCreate",msg => { + if (!DISABLE.commands.text.delete) client.on("messageCreate",msg => { if (!msg.content.startsWith(config.prefix+"delete")) return if (!msg.guild) return @@ -46,7 +47,7 @@ module.exports = () => { }) - client.on("interactionCreate",(interaction) => { + if (!DISABLE.commands.slash.delete) client.on("interactionCreate",(interaction) => { if (!interaction.isChatInputCommand()) return if (interaction.commandName != "delete") return diff --git a/commands/help.js b/commands/help.js index ef5a6ab..47a66fe 100644 --- a/commands/help.js +++ b/commands/help.js @@ -6,6 +6,7 @@ const log = bot.errorLog.log const l = bot.language const APIEvents = require("../core/api/modules/events") +const DISABLE = require("../core/api/api.json").disable module.exports = () => { bot.errorLog.log("debug","COMMANDS: loaded help.js") @@ -22,7 +23,7 @@ module.exports = () => { var otherprefix = prefix.endsWith(" ") ? prefix.substring(0,prefix.length-1) : prefix - client.on("messageCreate",msg => { + if (!DISABLE.commands.text.help) client.on("messageCreate",msg => { if (!msg.content.startsWith(config.prefix)) return var args = msg.content.split(config.prefix) @@ -42,7 +43,7 @@ module.exports = () => { } }) - client.on("interactionCreate",(interaction) => { + if (!DISABLE.commands.slash.help) client.on("interactionCreate",(interaction) => { if (!interaction.isChatInputCommand()) return if (interaction.commandName != "help") return diff --git a/commands/remove.js b/commands/remove.js index 7d08b6f..e5f8a4a 100644 --- a/commands/remove.js +++ b/commands/remove.js @@ -7,11 +7,12 @@ const l = bot.language const permsChecker = require("../core/utils/permisssionChecker") const APIEvents = require("../core/api/modules/events") +const DISABLE = require("../core/api/api.json").disable module.exports = () => { bot.errorLog.log("debug","COMMANDS: loaded remove.js") - client.on("messageCreate",msg => { + if (!DISABLE.commands.text.remove) client.on("messageCreate",msg => { if (!msg.content.startsWith(config.prefix+"remove")) return var user = msg.mentions.users.first() if (!user) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" ``:\n`"+config.prefix+"remove `")]}) @@ -43,7 +44,7 @@ module.exports = () => { }) - client.on("interactionCreate",async (interaction) => { + if (!DISABLE.commands.slash.remove) client.on("interactionCreate",async (interaction) => { if (!interaction.isChatInputCommand()) return if (interaction.commandName != "remove") return const user = interaction.options.getUser("user") diff --git a/commands/rename.js b/commands/rename.js index 8e1e852..6741658 100644 --- a/commands/rename.js +++ b/commands/rename.js @@ -7,11 +7,12 @@ const l = bot.language const permsChecker = require("../core/utils/permisssionChecker") const APIEvents = require("../core/api/modules/events") +const DISABLE = require("../core/api/api.json").disable module.exports = () => { bot.errorLog.log("debug","COMMANDS: loaded rename.js") - client.on("messageCreate",msg => { + if (!DISABLE.commands.text.rename) client.on("messageCreate",msg => { if (!msg.content.startsWith(config.prefix+"rename")) return if (!msg.guild) return @@ -52,7 +53,7 @@ module.exports = () => { }) - client.on("interactionCreate",(interaction) => { + if (!DISABLE.commands.slash.rename) client.on("interactionCreate",(interaction) => { if (!interaction.isChatInputCommand()) return if (interaction.commandName != "rename") return diff --git a/commands/reopen.js b/commands/reopen.js index 03a009b..3c86a0f 100644 --- a/commands/reopen.js +++ b/commands/reopen.js @@ -7,11 +7,12 @@ const l = bot.language const permsChecker = require("../core/utils/permisssionChecker") const APIEvents = require("../core/api/modules/events") +const DISABLE = require("../core/api/api.json").disable module.exports = () => { bot.errorLog.log("debug","COMMANDS: loaded reopen.js") - client.on("messageCreate",msg => { + if (!DISABLE.commands.text.reopen) client.on("messageCreate",msg => { if (!msg.content.startsWith(config.prefix+"reopen")) return msg.channel.messages.fetchPinned().then(msglist => { @@ -32,7 +33,7 @@ module.exports = () => { }) - client.on("interactionCreate",async (interaction) => { + if (!DISABLE.commands.slash.reopen) client.on("interactionCreate",async (interaction) => { if (!interaction.isChatInputCommand()) return if (interaction.commandName != "reopen") return diff --git a/commands/ticket.js b/commands/ticket.js index 8f14bcd..5f8e2bc 100644 --- a/commands/ticket.js +++ b/commands/ticket.js @@ -7,6 +7,7 @@ const l = bot.language const permsChecker = require("../core/utils/permisssionChecker") const APIEvents = require("../core/api/modules/events") +const DISABLE = require("../core/api/api.json").disable module.exports = () => { bot.errorLog.log("debug","COMMANDS: loaded ticket.js") @@ -18,7 +19,7 @@ module.exports = () => { }) - client.on("messageCreate", msg => { + if (!DISABLE.commands.text.msg) client.on("messageCreate", msg => { if (msg.content.startsWith(config.prefix+"msg"||config.prefix+"message")){ if (!msg.guild) return @@ -42,7 +43,7 @@ module.exports = () => { } }) - client.on("interactionCreate", (interaction) => { + if (!DISABLE.commands.slash.msg) client.on("interactionCreate", (interaction) => { if (!interaction.isChatInputCommand()) return if (interaction.commandName != "message") return diff --git a/core/api/api.json b/core/api/api.json index 29f74d3..f3456a0 100644 --- a/core/api/api.json +++ b/core/api/api.json @@ -1,11 +1,12 @@ { "version":"1.0.0", - - - "disclaimer":"DISABLE doesn't work yet! Below this message!", "enableAPIdebug":false, + + "info":"If you turn these switches to true, then the feature will be turned OFF!", + "info2":"You can use this to disable some features you don't want!", "disable":{ "messages":{ + "DISCLAIMER":"the messages part doesn't work yet!", "ticketCreated":false, "ticketClosed":false, "ticketDeleted":false, diff --git a/core/checker.js b/core/checker.js index 2dccb82..4fff2a1 100644 --- a/core/checker.js +++ b/core/checker.js @@ -331,7 +331,9 @@ exports.checker = async () => { checkHexColor(config.main_color,"main_color") checkDiscord("serverid",config.server_id,"server_id") - checkToken(config.auth_token) + + if (!require("./api/api.json").disable.checkerjs.token) checkToken(config.auth_token) + checkDiscordArray("roleid",config.main_adminroles,"main_adminroles") checkString(config.prefix,1,15,"prefix","prefix") //languagefile diff --git a/core/ticketActions/ticketCloser.js b/core/ticketActions/ticketCloser.js index 903d3dc..588cfbe 100755 --- a/core/ticketActions/ticketCloser.js +++ b/core/ticketActions/ticketCloser.js @@ -294,7 +294,7 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) => if (fileattachment == false){log("system","internal error: transcript is not created!");return} } - if (config.system.enable_transcript){ + if (config.system.enable_transcript && !require("../api/api.json").disable.transcripts.server){ const transcriptEmbed = new discord.EmbedBuilder() .setColor(config.main_color) .setTitle("📄 "+l.messages.newTranscriptTitle) @@ -307,7 +307,7 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) => }) } - if (config.system.enable_DM_transcript){ + if (config.system.enable_DM_transcript && !require("../api/api.json").disable.transcripts.dm){ const transcriptEmbed = new discord.EmbedBuilder() .setColor(config.main_color) .setTitle("📄 "+l.messages.newTranscriptTitle) diff --git a/index.js b/index.js index b5d3d9a..20b47e6 100644 --- a/index.js +++ b/index.js @@ -165,7 +165,7 @@ client.on('ready',async () => { require("./core/api/pluginlauncher")() this.errorLog.log("debug","loading plugins") }) - require("./core/checker").checker() +if (!require("./core/api/api.json").disable.checkerjs.all) require("./core/checker").checker() this.errorLog.log("debug","loading checker.js") this.errorLog.log("debug","checking config...")