From b57794e5a17140610feec3f0f584a4c0187b518a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20Olausson=20Holten=C3=A4s?= Date: Sun, 6 Mar 2022 14:54:26 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20send=20a=20DM=20to=20the=20person?= =?UTF-8?q?=20who=20bent=20gifted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/credits/addons/gift.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/commands/credits/addons/gift.js b/src/commands/credits/addons/gift.js index 46e2145..10c4d87 100644 --- a/src/commands/credits/addons/gift.js +++ b/src/commands/credits/addons/gift.js @@ -41,6 +41,7 @@ module.exports = async (interaction) => { }; return await interaction.editReply({ embeds: [embed], ephemeral: true }); } + // eslint-disable-next-line max-len const fromUser = await credits.findOne({ userId: interaction.user.id, guildId: interaction.member.guild.id }); const toUser = await credits.findOne({ userId: user.id, guildId: interaction.member.guild.id }); @@ -59,7 +60,7 @@ module.exports = async (interaction) => { await saveUser(fromUser, toUser); - const embed = { + const interactionEmbed = { title: 'Gift', description: `You sent ${creditNoun(amount)} to ${user}. Your new balance is ${creditNoun( fromUser.balance, @@ -68,8 +69,19 @@ module.exports = async (interaction) => { timestamp: new Date(), footer: { iconURL: config.footer.icon, text: config.footer.text }, }; + const dmEmbed = { + title: 'Gift', + description: `You recieved ${creditNoun(amount)} from ${interaction.user}. Your new balance is ${creditNoun( + toUser.balance, + )}.`, + color: 0x22bb33, + timestamp: new Date(), + footer: { iconURL: config.footer.icon, text: config.footer.text }, + }; + const dmUser = await interaction.client.users.cache.get(user.id); + await dmUser.send({ embeds: [dmEmbed] }); await logger.debug(`Gift sent from: ${interaction.user.username} to: ${user.username}`); - return await interaction.editReply({ embeds: [embed], ephemeral: true }); + return await interaction.editReply({ embeds: [interactionEmbed], ephemeral: true }); } catch { await logger.error(); }