getmember function

This commit is contained in:
Emily 2021-03-04 11:04:31 +11:00
parent 41cb3ec2b6
commit 936dd91407

View file

@ -104,6 +104,21 @@ class Functions {
return;
}
async getMember (guild, memberID) {
if (guild.members.has(memberID)) return guild.members.get(memberID);
this.client.logger.debug('REST_FETCH_MEMBER', 'Accessing rest API...');
const member = await this.client.getRESTGuildMember(guild.id, memberID).catch(err => {
this.client.logger.error('MEMBER_FETCH_ERROR', err);
});
if (member) {
guild.members.set(memberID, member);
return member;
}
return;
}
async getGuild (id) {
if (this.client.guilds.has(id)) return this.client.guilds.get(id);