awating sleep
dimdenGD opened this issue · 1 comments
dimdenGD commented
In Tracking used invites there's this snippet of code
// Initialize the invite cache
const invites = {};
// A pretty useful method to create a delay without blocking the whole script.
const wait = require('util').promisify(setTimeout);
client.on('ready', () => {
// "ready" isn't really ready. We need to wait a spell.
wait(1000);
// Load all invites for all guilds and save them to the cache.
client.guilds.forEach(g => {
g.fetchInvites().then(guildInvites => {
invites[g.id] = guildInvites;
});
});
});And I don't understand why wait(1000) function is being used without await, I think it doesn't do anything without awaiting for it..
eslachance commented
You're correct, that was a mistake, I've corrected the guide. Thanks!