Fix rare crash in typingProxy

cshd
Dragory 2020-08-18 21:43:30 +03:00
parent 883d8adf93
commit 47125fd7fd
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
1 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,11 @@ module.exports = ({ bot }) => {
// Typing proxy: forwarding typing events between the DM and the modmail thread
if(config.typingProxy || config.typingProxyReverse) {
bot.on("typingStart", async (channel, user) => {
if (! user) {
// If the user doesn't exist in the bot's cache, it will be undefined here
return;
}
// config.typingProxy: forward user typing in a DM to the modmail thread
if (config.typingProxy && (channel instanceof Eris.PrivateChannel)) {
const thread = await threads.findOpenThreadByUserId(user.id);