Add error handling for getDMChannel
parent
c306479d8a
commit
26c468d5fb
11
src/index.js
11
src/index.js
|
@ -183,9 +183,14 @@ 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;
|
||||||
let dm;
|
try {
|
||||||
dm = await bot.getDMChannel(thread.userId);
|
let dm;
|
||||||
bot.sendChannelTyping(dm.id);
|
dm = await bot.getDMChannel(thread.userId);
|
||||||
|
bot.sendChannelTyping(dm.id);
|
||||||
|
}
|
||||||
|
catch(error) {
|
||||||
|
console.log("An error occured when trying to type in DM.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue