Socket
Socket
Sign inDemoInstall

@notenoughupdates/discord-akairo

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@notenoughupdates/discord-akairo - npm Package Compare versions

Comparing version 9.0.10-dev.1639527744.5797f7f to 9.0.10-dev.1640126238.7a56253

3

dist/package.json
{
"name": "@notenoughupdates/discord-akairo",
"version": "9.0.10-dev.1639527744.5797f7f",
"version": "9.0.10-dev.1640126238.7a56253",
"description": "A highly customizable bot framework for Discord.js.",

@@ -50,2 +50,3 @@ "main": "./dist/src/index.js",

"eslint-config-prettier": "^8.3.0",
"eslint-plugin-deprecation": "^1.3.2",
"prettier": "^2.5.1",

@@ -52,0 +53,0 @@ "rimraf": "^3.0.2",

@@ -260,2 +260,3 @@ "use strict";

return null;
// eslint-disable-next-line deprecation/deprecation
return channel;

@@ -272,2 +273,3 @@ },

const storeChannels = channels.filter(c => c.type === "GUILD_STORE");
// eslint-disable-next-line deprecation/deprecation
return storeChannels.size ? storeChannels : null;

@@ -274,0 +276,0 @@ },

@@ -10,2 +10,3 @@ import { APIMessage } from "discord-api-types";

export default class CommandUtil<MessageType extends AkairoMessage | Message> {
static deletedMessages: Set<string>;
/**

@@ -40,2 +41,6 @@ * The command handler.

/**
* Whether or not `this.message` has been deleted.
*/
get deleted(): boolean;
/**
* @param handler - The command handler.

@@ -46,2 +51,7 @@ * @param message - Message that triggered the command.

/**
* Sets up the deleted message handler.
* @param client The client of the command handler
*/
private setUpDeletedMessageHandler;
/**
* Whether or not the provided message is a slash message

@@ -48,0 +58,0 @@ * @param message - The message to test

@@ -25,4 +25,22 @@ "use strict";

this.isSlash = this.message instanceof AkairoMessage_js_1.default;
this.setUpDeletedMessageHandler(handler.client);
}
/**
* Whether or not `this.message` has been deleted.
*/
get deleted() {
return this.isSlash ? false : CommandUtil.deletedMessages.has(this.message.id);
}
/**
* Sets up the deleted message handler.
* @param client The client of the command handler
*/
setUpDeletedMessageHandler(client) {
client.on("messageDelete", message => {
if (message.inGuild()) {
CommandUtil.deletedMessages.add(message.id);
}
});
}
/**
* Whether or not the provided message is a slash message

@@ -57,6 +75,3 @@ * @param message - The message to test

const newOptions = (typeof options === "string" ? { content: options } : options);
if (!this.isSlashMessage(this.message) &&
!this.shouldEdit &&
!(newOptions instanceof discord_js_1.MessagePayload) &&
!this.message.deleted) {
if (!this.isSlashMessage(this.message) && !this.shouldEdit && !(newOptions instanceof discord_js_1.MessagePayload) && !this.deleted) {
newOptions.reply = {

@@ -74,3 +89,6 @@ messageReference: this.message,

newOptions.ephemeral = undefined;
if (this.shouldEdit && !hasFiles && !this.lastResponse.deleted && !this.lastResponse.attachments.size) {
if (this.shouldEdit &&
!hasFiles &&
!CommandUtil.deletedMessages.has(this.lastResponse.id) &&
!this.lastResponse.attachments.size) {
return this.lastResponse.edit(newOptions);

@@ -143,2 +161,3 @@ }

exports.default = CommandUtil;
CommandUtil.deletedMessages = new Set();
//# sourceMappingURL=CommandUtil.js.map

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

.map((word, index) => {
if (index !== 1)
if (index !== 0)
return word.charAt(0).toUpperCase() + word.slice(1);

@@ -130,0 +130,0 @@ return word;

{
"name": "@notenoughupdates/discord-akairo",
"version": "9.0.10-dev.1639527744.5797f7f",
"version": "9.0.10-dev.1640126238.7a56253",
"description": "A highly customizable bot framework for Discord.js.",

@@ -50,2 +50,3 @@ "main": "./dist/src/index.js",

"eslint-config-prettier": "^8.3.0",
"eslint-plugin-deprecation": "^1.3.2",
"prettier": "^2.5.1",

@@ -52,0 +53,0 @@ "rimraf": "^3.0.2",

@@ -1007,3 +1007,5 @@ import type {

newsChannels: Collection<string, NewsChannel>;
// eslint-disable-next-line deprecation/deprecation
storeChannel: StoreChannel;
// eslint-disable-next-line deprecation/deprecation
storeChannels: Collection<string, StoreChannel>;

@@ -1010,0 +1012,0 @@ stageChannel: StageChannel;

@@ -308,2 +308,3 @@ import {

// eslint-disable-next-line deprecation/deprecation
return channel as StoreChannel;

@@ -319,2 +320,3 @@ },

const storeChannels = channels.filter(c => c.type === "GUILD_STORE");
// eslint-disable-next-line deprecation/deprecation
return storeChannels.size ? (storeChannels as Collection<string, StoreChannel>) : null;

@@ -321,0 +323,0 @@ },

@@ -15,2 +15,3 @@ /* eslint-disable require-await */

import AkairoMessage from "../../util/AkairoMessage.js";
import AkairoClient from "../AkairoClient.js";
import type ContextMenuCommandHandler from "../contextMenuCommands/ContextMenuCommandHandler.js";

@@ -23,2 +24,4 @@ import CommandHandler, { ParsedComponentData } from "./CommandHandler.js";

export default class CommandUtil<MessageType extends AkairoMessage | Message> {
public static deletedMessages = new Set<Snowflake>();
/**

@@ -60,2 +63,9 @@ * The command handler.

/**
* Whether or not `this.message` has been deleted.
*/
public get deleted(): boolean {
return this.isSlash ? false : CommandUtil.deletedMessages.has(this.message.id);
}
/**
* @param handler - The command handler.

@@ -72,5 +82,18 @@ * @param message - Message that triggered the command.

this.isSlash = this.message instanceof AkairoMessage;
this.setUpDeletedMessageHandler(handler.client);
}
/**
* Sets up the deleted message handler.
* @param client The client of the command handler
*/
private setUpDeletedMessageHandler(client: AkairoClient) {
client.on("messageDelete", message => {
if (message.inGuild()) {
CommandUtil.deletedMessages.add(message.id);
}
});
}
/**
* Whether or not the provided message is a slash message

@@ -132,8 +155,3 @@ * @param message - The message to test

if (
!this.isSlashMessage(this.message) &&
!this.shouldEdit &&
!(newOptions instanceof MessagePayload) &&
!(this.message as Message).deleted
) {
if (!this.isSlashMessage(this.message) && !this.shouldEdit && !(newOptions instanceof MessagePayload) && !this.deleted) {
(newOptions as MessageOptions).reply = {

@@ -158,3 +176,8 @@ messageReference: this.message,

(newOptions as InteractionReplyOptions).ephemeral = undefined;
if (this.shouldEdit && !hasFiles && !this.lastResponse!.deleted && !this.lastResponse!.attachments.size) {
if (
this.shouldEdit &&
!hasFiles &&
!CommandUtil.deletedMessages.has(this.lastResponse!.id) &&
!this.lastResponse!.attachments.size
) {
return this.lastResponse!.edit(newOptions);

@@ -161,0 +184,0 @@ }

@@ -131,3 +131,3 @@ /* eslint-disable @typescript-eslint/ban-types */

.map((word, index) => {
if (index !== 1) return word.charAt(0).toUpperCase() + word.slice(1);
if (index !== 0) return word.charAt(0).toUpperCase() + word.slice(1);
return word;

@@ -134,0 +134,0 @@ })

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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