Fix rare crash in typingProxy
parent
883d8adf93
commit
47125fd7fd
|
@ -6,6 +6,11 @@ module.exports = ({ bot }) => {
|
||||||
// Typing proxy: forwarding typing events between the DM and the modmail thread
|
// Typing proxy: forwarding typing events between the DM and the modmail thread
|
||||||
if(config.typingProxy || config.typingProxyReverse) {
|
if(config.typingProxy || config.typingProxyReverse) {
|
||||||
bot.on("typingStart", async (channel, user) => {
|
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
|
// config.typingProxy: forward user typing in a DM to the modmail thread
|
||||||
if (config.typingProxy && (channel instanceof Eris.PrivateChannel)) {
|
if (config.typingProxy && (channel instanceof Eris.PrivateChannel)) {
|
||||||
const thread = await threads.findOpenThreadByUserId(user.id);
|
const thread = await threads.findOpenThreadByUserId(user.id);
|
||||||
|
|
Loading…
Reference in New Issue