Fetch all alert users at startup
This commit is contained in:
parent
54eb401093
commit
9393bf8f94
11
index.js
11
index.js
|
@ -456,7 +456,6 @@ xmpp.on("stanza", (stanza) => {
|
|||
// If the event type is not in th filter, ignore it. Make sure filterEvt isnt null
|
||||
if (!filterEvt[0]) filterEvt = [];
|
||||
if (!filterEvt.includes(evt.code.toLowerCase()) && !filterEvt.length == 0) return;
|
||||
|
||||
let user = discord.users.cache.get(row.userid);
|
||||
if (!user) return console.log(`${colors.red("[ERROR]")} User ${row.userid} not found`);
|
||||
|
||||
|
@ -678,6 +677,16 @@ discord.on('ready', async () => {
|
|||
};
|
||||
});
|
||||
});
|
||||
|
||||
// Get all users in userAlerts and fetch them
|
||||
db.all(`SELECT userid FROM userAlerts`, (err, rows) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
rows.forEach((row) => {
|
||||
discord.users.fetch(row.userid);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
discord.on("interactionCreate", async (interaction) => {
|
||||
|
|
Loading…
Reference in a new issue