replapi-it
Version:
An all-in-one API for replit.com
29 lines (27 loc) • 832 B
JavaScript
const Collection = require('../structures/collection');
class FollowerManager {
constructor(client, user) {
this.
this.cache = new Collection();
this.
}
async fetch(options = {}) {
options = { cache: true, limit: 10, ...options };
let res = await this.
let users = res.userByUsername.followers.items;
let c = new Collection();
for (let u of users) {
let user = new this.
await user.update(u);
if (options.cache) {
this.cache.set(user.username, user);
this.
}
c.set(user.username, user);
}
return c;
}
}
module.exports = FollowerManager;