From 597a588132a591778df7523eb4f7e63e0fe4745a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Guzman?= <36934590+mgsi100@users.noreply.github.com> Date: Thu, 3 Dec 2020 22:26:28 +0100 Subject: [PATCH 1/4] edited the command so that the message is send to a channel instead of to the creator --- src/commands/close.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/commands/close.js b/src/commands/close.js index c935eb6..c336456 100644 --- a/src/commands/close.js +++ b/src/commands/close.js @@ -126,13 +126,7 @@ module.exports = { let u = await client.users.fetch(ticket.creator); if (u) { - let dm; - try { - dm = u.dmChannel || await u.createDM(); - } catch (e) { - log.warn(`Could not create DM channel with ${u.tag}`); - } - + const archive = client.channels.cache.find(ch => ch.id === "yourchannelidhere") let res = {}; const embed = new MessageEmbed() @@ -163,9 +157,9 @@ module.exports = { try { - dm.send(res).then(); + archive.send(res) } catch (e) { - message.channel.send('❌ Couldn\'t send DM'); + message.channel.send('❌ Couldn\'t send to Logging Channel.'); } } } From 9b4dcdee51d8ceef63f759712e72bdcd2c38514b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Guzman?= <36934590+mgsi100@users.noreply.github.com> Date: Thu, 3 Dec 2020 22:30:29 +0100 Subject: [PATCH 2/4] Removed an oopsie --- src/commands/close.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/close.js b/src/commands/close.js index c336456..ee5df32 100644 --- a/src/commands/close.js +++ b/src/commands/close.js @@ -126,7 +126,7 @@ module.exports = { let u = await client.users.fetch(ticket.creator); if (u) { - const archive = client.channels.cache.find(ch => ch.id === "yourchannelidhere") + const archive = client.channels.cache.find(ch => ch.id === "") let res = {}; const embed = new MessageEmbed() From 390bec85c87f4fc47835daabb61f4b3fed316c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Guzman?= <36934590+mgsi100@users.noreply.github.com> Date: Thu, 3 Dec 2020 22:40:33 +0100 Subject: [PATCH 3/4] Made it so the bot dm's the creator and logs it in an logging channel --- src/commands/close.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/commands/close.js b/src/commands/close.js index ee5df32..390cc21 100644 --- a/src/commands/close.js +++ b/src/commands/close.js @@ -126,6 +126,12 @@ module.exports = { let u = await client.users.fetch(ticket.creator); if (u) { + let dm; + try { + dm = u.dmChannel || await u.createDM(); + } catch (e) { + log.warn(`Could not create DM channel with ${u.tag}`); + } const archive = client.channels.cache.find(ch => ch.id === "") let res = {}; @@ -158,6 +164,7 @@ module.exports = { try { archive.send(res) + dm.send(res) } catch (e) { message.channel.send('❌ Couldn\'t send to Logging Channel.'); } From 2b5282b19e0bf982b02a17c371671231e026b9e1 Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 3 Dec 2020 21:59:41 +0000 Subject: [PATCH 4/4] Update close.js --- src/commands/close.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/commands/close.js b/src/commands/close.js index 390cc21..c4bedbe 100644 --- a/src/commands/close.js +++ b/src/commands/close.js @@ -132,7 +132,7 @@ module.exports = { } catch (e) { log.warn(`Could not create DM channel with ${u.tag}`); } - const archive = client.channels.cache.find(ch => ch.id === "") + let res = {}; const embed = new MessageEmbed() @@ -160,13 +160,12 @@ module.exports = { } res.embed = embed; - try { - archive.send(res) - dm.send(res) + dm.send(res); + if (config.logs.discord.enabled) client.channels.cache.get(config.logs.discord.channel).send(res); } catch (e) { - message.channel.send('❌ Couldn\'t send to Logging Channel.'); + message.channel.send('❌ Couldn\'t send DM or transcript log message'); } } } @@ -228,4 +227,4 @@ module.exports = { }); } -}; \ No newline at end of file +};