From cd0c088c4ec2ef0ab775319123ec3d6299c13afe Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Thu, 16 Feb 2023 09:13:50 -0500 Subject: [PATCH] Make reminders visually distinct --- data/strings.json | 4 ++++ modules/functions.js | 31 ++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/data/strings.json b/data/strings.json index 18280d2..fe4d980 100644 --- a/data/strings.json +++ b/data/strings.json @@ -20,6 +20,10 @@ "embeds": { "footer": "Silvanus is not affiliated with Grow A Tree or Limbo Labs", "color": "0x55FF55", + "waterColor": "0x5555FF", + "fruitColor": "0xCC5555", + "waterTitle": "Water Notification", + "fruitTitle": "Fruit Notification", "roleMenuTitle": "Role Menu", "treeRoleMenu": [ "Use the buttons below to give yourself roles.\n\n", diff --git a/modules/functions.js b/modules/functions.js index ce083a3..0e7b0e2 100644 --- a/modules/functions.js +++ b/modules/functions.js @@ -124,11 +124,21 @@ const functions = { const messageContents = { embeds: [embed], components: [this.actionRows.comparisonActionRow(guildInfo)] }; return messageContents; }, - reminderEmbed(content, guildInfo) { + waterReminderEmbed(content, guildInfo) { // Create the embed using the content passed to this function const embed = new EmbedBuilder() - .setColor(strings.embeds.color) - .setTitle('Notification Relay') + .setColor(strings.embeds.waterColor) + .setTitle(strings.embeds.waterTitle) + .setDescription(`[Click here to go to your Tree](https://discord.com/channels/${guildInfo.guildId}/${guildInfo.treeChannelId}/${guildInfo.treeMessageId})`) + .setFooter({ text: `Click ♻️ to delete this message` }); + const messageContents = { content: content, embeds: [embed], components: [this.actionRows.reminderActionRow()] }; + return messageContents; + }, + fruitReminderEmbed(content, guildInfo) { + // Create the embed using the content passed to this function + const embed = new EmbedBuilder() + .setColor(strings.embeds.fruitColor) + .setTitle(strings.embeds.fruitTitle) .setDescription(`[Click here to go to your Tree](https://discord.com/channels/${guildInfo.guildId}/${guildInfo.treeChannelId}/${guildInfo.treeMessageId})`) .setFooter({ text: `Click ♻️ to delete this message` }); const messageContents = { content: content, embeds: [embed], components: [this.actionRows.reminderActionRow()] }; @@ -588,9 +598,16 @@ const functions = { }, ms); }); }, - async sendReminder(guildInfo, message, channelId, guild) { + async sendWaterReminder(guildInfo, message, channelId, guild) { const reminderChannel = await guild.channels.fetch(channelId); - const reminderEmbed = functions.builders.reminderEmbed(message, guildInfo); + const reminderEmbed = functions.builders.waterReminderEmbed(message, guildInfo); + await reminderChannel.send(reminderEmbed).catch(err => { + console.error(err); + }); + }, + async sendFruitReminder(guildInfo, message, channelId, guild) { + const reminderChannel = await guild.channels.fetch(channelId); + const reminderEmbed = functions.builders.fruitReminderEmbed(message, guildInfo); await reminderChannel.send(reminderEmbed).catch(err => { console.error(err); }); @@ -612,9 +629,9 @@ const functions = { guildInfo = client.guildInfos.get(guild.id); console.log(message.embeds); if (message.embeds[0].data.description.includes(strings.notifications.water)) { - this.sendReminder(guildInfo, guildInfo.waterMessage, guildInfo.reminderChannelId, guild); + this.sendWaterReminder(guildInfo, guildInfo.waterMessage, guildInfo.reminderChannelId, guild); } else if (message.embeds[0].data.description.includes(strings.notifications.fruit)) { - this.sendReminder(guildInfo, guildInfo.fruitMessage, guildInfo.reminderChannelId, guild); + this.sendFruitReminder(guildInfo, guildInfo.fruitMessage, guildInfo.reminderChannelId, guild); } }); }