From 0ba639af3e7dcbe811e9c766571a56dbc5d1b43f Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Wed, 31 Mar 2021 20:58:53 -0500 Subject: [PATCH] Change scope of role declarations --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 6e8b867..0ba6237 100644 --- a/index.js +++ b/index.js @@ -2,9 +2,7 @@ const Discord = require('discord.js'); const client = new Discord.Client({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] }); -const readerRole = message.guild.roles.cache.get("826840765526835240"); -const specRole = message.guild.roles.cache.get("826849213954523216"); -const writerRole = message.guild.roles.cache.get("826508727855087723"); + client.on("ready", () => { console.log("Logged in as " + client.user.tag + "!"); @@ -24,6 +22,9 @@ client.on("message", message => { }); async function roleRequest(message) { + const readerRole = message.guild.roles.cache.get("826840765526835240"); + const specRole = message.guild.roles.cache.get("826849213954523216"); + const writerRole = message.guild.roles.cache.get("826508727855087723"); const role = message.content.substring(13).toLowerCase(); const possibleRoles = ['spec', 'spectator', 'reader', 'writer']; if (possibleRoles.indexOf(role) === -1) {