From babb45f461e09b0716ee8ed360045d6d72441143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Gro=C3=9F?= Date: Wed, 5 Apr 2023 17:17:10 +0200 Subject: [PATCH] Drop: Only ping when wishlist pings are enabled by the user. --- commands/drop.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/drop.js b/commands/drop.js index 2fb8093..318f8aa 100644 --- a/commands/drop.js +++ b/commands/drop.js @@ -109,17 +109,18 @@ module.exports = { }, { model: User, - attributes: ['discordId'] + attributes: ['discordId', 'wishlistPing'] }] }); + wishlists = wishlists.filter(wishlist => wishlist.User.wishlistPing); wishlists.forEach(wishlist => { - if(guildMembers.includes(wishlist.User.discordId)) { + if(wishlist.User.wishlistPing && guildMembers.includes(wishlist.User.discordId)) { pings.push(`<@${wishlist.User.discordId}>`); } }); if (wishlists.length > 0) { - let debug = wishlists[0]; - pings.push(`your wishlisted character ${debug.Characters[0].name} is in this drop!\n`); + let character = wishlists[0].Characters[0]; + pings.push(`your wishlisted character ${character.name} is in this drop!\n`); } } //add 10 experience to the user