Skip to content

Commit

Permalink
v1.3.2 Lauched
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatsLiamS committed May 31, 2021
1 parent 6415e63 commit a5290eb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -27,4 +27,4 @@
"url": "https://github.com/ThatsLiamS/discord.js-ghost-ping/issues"
},
"homepage": "https://github.com/ThatsLiamS/discord.js-ghost-ping#readme"
}
}
17 changes: 12 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
5 changes: 5 additions & 0 deletions src/util/embedValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@ const Discord = require('discord.js')

function embedValues(object, message){

/* Default Values */
let editedValues = {
title: 'Ghost Ping Detected',
color: 'C0C0C0',
picture: 'https://i.imgur.com/k6pLhtU.png',
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
Expand Down

0 comments on commit a5290eb

Please sign in to comment.