From a5290eb082167e8768c8589cc845ed88240a215d Mon Sep 17 00:00:00 2001 From: Liam Skinner Date: Mon, 31 May 2021 22:12:56 +0100 Subject: [PATCH] v1.3.2 Lauched --- package-lock.json | 4 ++-- package.json | 4 ++-- src/index.js | 17 ++++++++++++----- src/util/embedValues.js | 5 +++++ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index ef2456d..71e345a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "discord.js-ghost-ping", - "version": "1.3.1", + "version": "1.3.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.3.1", + "version": "1.3.2", "license": "MIT", "dependencies": { "discord.js": "^12.5.3" diff --git a/package.json b/package.json index bc1ee69..a611c49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord.js-ghost-ping", - "version": "1.3.1", + "version": "1.3.2", "description": "Detect Ghost Pings inside of discord.js!", "main": "src/index.js", "scripts": { @@ -27,4 +27,4 @@ "url": "https://github.com/ThatsLiamS/discord.js-ghost-ping/issues" }, "homepage": "https://github.com/ThatsLiamS/discord.js-ghost-ping#readme" -} +} \ No newline at end of file diff --git a/src/index.js b/src/index.js index af2ef8a..9462e3f 100644 --- a/src/index.js +++ b/src/index.js @@ -4,13 +4,20 @@ const { ErrorMessages } = require(`${__dirname}/util/errors`) function detector(EventType, ...args){ if(EventType){ - if(EventType == 'messageDelete'){ messageDelete(...args) } - else if(EventType == 'messageUpdate'){ messageUpdate(...args) } + if(EventType == 'messageDelete'){ + boolean = messageDelete(...args) + return boolean + } + if(EventType == 'messageUpdate'){ + boolean = messageUpdate(...args) + return boolean + } - else{ ErrorMessages.unexpectedParameterError } - - } else{ throw ErrorMessages.expectedParameterError } + throw ErrorMessages.unexpectedParameterError + } else{ + throw ErrorMessages.expectedParameterError + } } module.exports = { diff --git a/src/util/embedValues.js b/src/util/embedValues.js index c0ddcad..ae1cee7 100644 --- a/src/util/embedValues.js +++ b/src/util/embedValues.js @@ -3,6 +3,7 @@ const Discord = require('discord.js') function embedValues(object, message){ + /* Default Values */ let editedValues = { title: 'Ghost Ping Detected', color: 'C0C0C0', @@ -10,14 +11,18 @@ function embedValues(object, message){ footer: 'Don\'t Ghost Ping, smh', channel: message.channel } + + /* Does the user provide the object? */ if(!object || object && (typeof object !== 'object')){ return editedValues } + /* Change the values */ if(object.title) editedValues.title = object.title if(object.color) editedValues.color = object.color if(object.picture) editedValues.picture = object.picture if(object.footer) editedValues.footer = object.footer if(object.channel) editedValues.channel = message.guild.channels.cache.get(object.channel) + /* Checks if the channel is a real channel */ if (!editedValues.channel instanceof Discord.TextChannel){ throw ErrorMessages.unableToGetChannel } return editedValues