awaitAvailability function returns Promise<Guild> now
This commit is contained in:
parent
fbd6eae244
commit
2fadcfa407
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue