diff --git a/index.js b/index.js index e64d5df..e0df641 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,7 @@ const client = new Discord.Client({ }, }); +const maxMessageCount = parseInt(process.env.MAX_MESSAGE_COUNT); let lastStickyMessage = ""; let messageCount = 0; let stickyMessageChannel = ""; @@ -27,7 +28,7 @@ client.on("message", async function (message) { if (stickyMessageContent !== "") { if (message.channel.id === stickyMessageChannel) { messageCount++; - if (messageCount === process.env.MAX_MESSAGE_COUNT) { + if (messageCount === maxMessageCount) { await lastStickyMessage.delete(); lastStickyMessage = await message.channel.send(stickyMessageContent); messageCount = 0;