New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ic4d

Package Overview
Dependencies
Maintainers
0
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ic4d - npm Package Compare versions

Comparing version 3.0.0-dev.2 to 3.0.0-dev.3

10

dist/handler/builders/SlashCommandManager.d.ts

@@ -49,2 +49,7 @@ import { Client, SlashCommandBuilder, ChatInputCommandInteraction, RESTPostAPIApplicationCommandsJSONBody } from "discord.js";

deleted: boolean;
/**
* Whether or not this command can only be found in the development release.
* To have dev commands disabled, enable `production` property in the CommandHandler HandlerFlags parameter
*/
isDev: boolean;
constructor(commandObject: {

@@ -78,2 +83,7 @@ /**

/**
* Set whether or not this command is only available in the developer release of said bot.
* @param bool If true, command is marked as developer.
*/
setDev(bool: boolean): SlashCommandManager;
/**
* Append all the interactions associated with this command, here if you'd like.

@@ -80,0 +90,0 @@ * @param interactions

@@ -21,2 +21,7 @@ "use strict";

this.botPermissions = [];
/**
* Whether or not this command can only be found in the development release.
* To have dev commands disabled, enable `production` property in the CommandHandler HandlerFlags parameter
*/
this.isDev = false;
this.data = commandObject.data.toJSON();

@@ -56,2 +61,10 @@ this.name = commandObject.data.name;

/**
* Set whether or not this command is only available in the developer release of said bot.
* @param bool If true, command is marked as developer.
*/
setDev(bool) {
this.isDev = bool;
return this;
}
/**
* Append all the interactions associated with this command, here if you'd like.

@@ -58,0 +71,0 @@ * @param interactions

13

dist/handler/commandHandler.d.ts

@@ -39,2 +39,3 @@ import { CoreHandler, Option } from "./coreHandler";

isOld?: boolean;
isDev?: boolean;
permissionsRequired?: bigint[];

@@ -63,2 +64,10 @@ botPermissions?: bigint[];

esImportsDisableNoExportFound?: boolean;
/**
* Whether or not this is the production version of the bot. If set to true, commands labelled `isDev` will NOT be loaded.
*/
production?: boolean;
/**
* Clears ALL application commands on startup. (Slash commands, User commands, and Message commands.)
*/
refreshApplicationCommands?: boolean;
}

@@ -74,3 +83,3 @@ /**

readerOptions: ReaderOptions;
iOptions: HandlerFlags;
flags: HandlerFlags;
/**

@@ -90,3 +99,3 @@ *

*/
registerCommands(logAll?: boolean, serverId?: string): Promise<void>;
registerCommands(logNoChanges?: boolean, serverId?: string): Promise<void>;
/**

@@ -93,0 +102,0 @@ * Handle Slash Commands

56

dist/handler/commandHandler.js

@@ -37,3 +37,3 @@ "use strict";

};
this.iOptions = {
this.flags = {
debugger: false,

@@ -43,2 +43,4 @@ disableLogs: false,

esImportsDisableNoExportFound: false,
production: true,
refreshApplicationCommands: false,
};

@@ -60,7 +62,11 @@ this.commandPath = path;

};
this.iOptions = {
debugger: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.debugger) || false,
disableLogs: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.disableLogs) || false,
esImports: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.esImports) || false,
esImportsDisableNoExportFound: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.esImportsDisableNoExportFound) || false,
this.flags = {
debugger: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.debugger) || this.flags.debugger,
disableLogs: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.disableLogs) || this.flags.disableLogs,
esImports: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.esImports) || this.flags.esImports,
esImportsDisableNoExportFound: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.esImportsDisableNoExportFound) ||
this.flags.esImportsDisableNoExportFound,
production: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.production) || this.flags.production,
refreshApplicationCommands: (handlerFlags === null || handlerFlags === void 0 ? void 0 : handlerFlags.refreshApplicationCommands) ||
this.flags.refreshApplicationCommands,
};

@@ -73,8 +79,12 @@ }

*/
async registerCommands(logAll, serverId) {
logAll = logAll !== undefined ? logAll : true;
async registerCommands(logNoChanges, serverId) {
logNoChanges = logNoChanges !== undefined ? logNoChanges : true;
try {
const localCommands = this.getLocalCommands(this.commandPath, this.iOptions.esImports);
const localCommands = this.getLocalCommands(this.commandPath, this.flags.esImports);
const applicationCommands = await this.getApplicationCommands(this.client, serverId);
if (this.flags.refreshApplicationCommands)
await applicationCommands.set([]);
for (const localCommand of localCommands) {
if (localCommand.isDev && this.flags.production)
continue;
let noChanges = true;

@@ -94,3 +104,3 @@ if (!localCommand.name ||

noChanges = false;
if (!this.iOptions.disableLogs)
if (!this.flags.disableLogs)
console.log(this.options.deleted.replace("NAME", name));

@@ -105,3 +115,3 @@ continue;

noChanges = false;
if (!this.iOptions.disableLogs)
if (!this.flags.disableLogs)
console.log((0, funcs_1.deprecated)(this.options.edited.replace("NAME", name), isOld));

@@ -114,3 +124,3 @@ }

noChanges = false;
if (!this.iOptions.disableLogs)
if (!this.flags.disableLogs)
console.log((0, funcs_1.deprecated)(this.options.skipped.replace("NAME", name), isOld));

@@ -128,3 +138,3 @@ continue;

noChanges = false;
if (!this.iOptions.disableLogs)
if (!this.flags.disableLogs)
console.log((0, funcs_1.deprecated)(this.options.loaded.replace("NAME", name), isOld));

@@ -136,4 +146,4 @@ }

}
if (logAll && noChanges == true) {
if (!this.iOptions.disableLogs)
if (logNoChanges && noChanges == true) {
if (!this.flags.disableLogs)
console.log((0, funcs_1.deprecated)(this.options.loadedNoChanges.replace("NAME", name), isOld));

@@ -158,3 +168,3 @@ }

async handleCommands(...middleWare) {
if (this.iOptions.debugger)
if (this.flags.debugger)
console.debug(clc.underline.blue("\nhandleCommands() has been called and has started executing.\n"));

@@ -165,3 +175,3 @@ this.client.on("interactionCreate", async (interaction) => {

return;
if (this.iOptions.debugger)
if (this.flags.debugger)
console.debug(clc.underline("'" + interaction.commandName + "' has been called."));

@@ -175,3 +185,3 @@ const localCommands = this.getLocalCommands(this.commandPath);

if (!this.readerOptions.devs.includes(interaction.user.id)) {
if (this.iOptions.debugger)
if (this.flags.debugger)
console.debug(clc.bold.blue("\tUser tried running " +

@@ -192,3 +202,3 @@ interaction.commandName +

!interaction.member.permissions.has(permission)) {
if (this.iOptions.debugger)
if (this.flags.debugger)
console.debug(clc.bold.blue("\tUser did not have enough permissions to run " +

@@ -209,3 +219,3 @@ interaction.commandName));

if (!bot.permissions.has(permission)) {
if (this.iOptions.debugger)
if (this.flags.debugger)
console.debug(clc.bold.blue("\tBot did not have the required permissions to run " +

@@ -221,7 +231,7 @@ interaction.commandName));

}
if (this.iOptions.debugger)
if (this.flags.debugger)
console.debug(clc.underline("\tMiddlewares Called:"));
for (const fn of middleWare) {
let result = await fn(commandObject, interaction);
if (this.iOptions.debugger) {
if (this.flags.debugger) {
const arr = fn.toString().split(" ");

@@ -239,3 +249,3 @@ // Means the function has (function a(){}) syntax, otherwise it's (()=>{}) syntax

}
if (this.iOptions.debugger)
if (this.flags.debugger)
console.debug(clc.bold.blue("Middlewares called, Callback to be called."));

@@ -242,0 +252,0 @@ await commandObject.callback(this.client, interaction);

{
"name": "ic4d",
"version": "3.0.0-dev.2",
"version": "3.0.0-dev.3",
"description": "Discord.js Interaction and Command handler 4 Dummies",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc