Attempt to not throw error when we cant DM a user!
Some checks are pending
ptero-push / build (push) Waiting to run
Some checks are pending
ptero-push / build (push) Waiting to run
This commit is contained in:
parent
79ae2f4c25
commit
ded7a2373c
25
index.js
25
index.js
|
@ -576,7 +576,28 @@ xmpp.on("stanza", (stanza) => {
|
|||
thisMsg.content = row.custommessage || null;
|
||||
user.send(thisMsg).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.log(`${colors.yellow("[WARN]")} Failed to send message to ${user.tag} (${user.id})`);
|
||||
const logChannel = discord.guilds.cache.get(config.discord.mainGuild).channels.cache.get(config.discord.logChannel);
|
||||
logChannel.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "Failed to send DM",
|
||||
description: `User may have DMs disabled, or bot doesnt' share a server anymore!.
|
||||
User: ${user.tag} (${user.id})
|
||||
Sub Info: \`\`\`json\n${JSON.stringify(row)}\`\`\``,
|
||||
color: 0xff0000
|
||||
}
|
||||
]
|
||||
}).then(() => {
|
||||
db.run(`DELETE FROM userAlerts WHERE userid = ? AND iemchannel = ?`, [user.id, fromChannel], (err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
console.log(`${colors.cyan("[INFO]")} Deleted user ${user.id} from database`);
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}).catch((err) => {
|
||||
setTimeout(() => {
|
||||
|
@ -1568,6 +1589,8 @@ discord.on("guildCreate", async (guild) => {
|
|||
]
|
||||
}
|
||||
]
|
||||
}).catch((err) => {
|
||||
console.log(`${colors.red("[ERROR]")} Failed to send message to user ${user.id}: ${err.message}`);
|
||||
})
|
||||
channel.send({
|
||||
embeds: [
|
||||
|
|
Loading…
Reference in a new issue