From 26c468d5fbc85e59360a1341a2edf939caa0ab21 Mon Sep 17 00:00:00 2001 From: judge2020 Date: Mon, 22 Jan 2018 17:34:12 -0500 Subject: [PATCH] Add error handling for getDMChannel --- src/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 6abf031..f561ec0 100644 --- a/src/index.js +++ b/src/index.js @@ -183,9 +183,14 @@ if(config.typingProxy || config.typingProxyReverse) { else if(config.typingProxyReverse && (channel instanceof Eris.GuildChannel) && ! user.bot) { thread = await threads.getByChannelId(channel.id); if (! thread) return; - let dm; - dm = await bot.getDMChannel(thread.userId); - bot.sendChannelTyping(dm.id); + try { + let dm; + dm = await bot.getDMChannel(thread.userId); + bot.sendChannelTyping(dm.id); + } + catch(error) { + console.log("An error occured when trying to type in DM."); + } } }); }