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,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.");
}
}
});
}