From 108e592bb03c749705ab3ffa3039ac26a2d1062d Mon Sep 17 00:00:00 2001 From: Kalissaac Date: Wed, 29 Jul 2020 20:18:52 -0700 Subject: [PATCH] Fix match notifications role giving --- package.json | 2 +- src/services/matchNotifications.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0f98586..f553ebd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrimbot", - "version": "1.2.0", + "version": "1.2.1", "description": "A Discord bot for organizing Valorant custom games.", "main": "src/index.js", "scripts": { diff --git a/src/services/matchNotifications.js b/src/services/matchNotifications.js index eeafb43..ea96f04 100644 --- a/src/services/matchNotifications.js +++ b/src/services/matchNotifications.js @@ -5,7 +5,11 @@ module.exports = exports = { GLOBALS.client.on('guildMemberAdd', async member => { const guildData = await GLOBALS.db.collection('guilds').doc(member.guild.id).get() if (!guildData.exists) return - member.roles.add(guildData.get('notificationRole')) + + const memberData = await GLOBALS.db.collection('users').doc(member.id).get() + if (memberData.exists && memberData.get('notifications')) { + member.roles.add(guildData.get('notificationRole')) + } }) } }