Add error handling for getDMChannel

master
judge2020 2018-01-22 17:34:12 -05:00
parent c306479d8a
commit 26c468d5fb
No known key found for this signature in database
GPG Key ID: 5BFD17372D7812CC
1 changed files with 8 additions and 3 deletions

View File

@ -183,10 +183,15 @@ if(config.typingProxy || config.typingProxyReverse) {
else if(config.typingProxyReverse && (channel instanceof Eris.GuildChannel) && ! user.bot) { else if(config.typingProxyReverse && (channel instanceof Eris.GuildChannel) && ! user.bot) {
thread = await threads.getByChannelId(channel.id); thread = await threads.getByChannelId(channel.id);
if (! thread) return; if (! thread) return;
try {
let dm; let dm;
dm = await bot.getDMChannel(thread.userId); dm = await bot.getDMChannel(thread.userId);
bot.sendChannelTyping(dm.id); bot.sendChannelTyping(dm.id);
} }
catch(error) {
console.log("An error occured when trying to type in DM.");
}
}
}); });
} }