awaitAvailability function returns Promise<Guild> now

This commit is contained in:
ZiomaleQ 2021-01-05 16:27:03 +01:00
parent fbd6eae244
commit 2fadcfa407

View file

@ -309,13 +309,13 @@ export class Guild extends Base {
/**
* Fulfills promise when guild becomes available
*/
async awaitAvailability(): Promise<void> {
async awaitAvailability(): Promise<Guild> {
return await new Promise((resolve, reject) => {
if(!this.unavailable) return;
const listener = (guild: Guild): void => {
if (guild.id === this.id) {
this.client.removeListener('guildLoaded', listener);
resolve();
resolve(this);
}
};
this.client.on('guildLoaded', listener);