feat: add a way to skip offline users when syncing members

This commit is contained in:
Paul Makles
2022-01-10 23:25:36 +00:00
parent f3943150dd
commit 25559abbf6
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"type": "module",
"name": "revolt.js",
"version": "5.2.4",
"version": "5.2.5",
"main": "dist/index.js",
"repository": "https://github.com/revoltchat/revolt.js",
"author": "Paul Makles <insrt.uk>",
+1 -1
View File
@@ -1,4 +1,4 @@
export const LIBRARY_VERSION = "5.2.4";
export const LIBRARY_VERSION = "5.2.5";
export const defaultConfig = {
apiURL: "https://api.revolt.chat",
+3 -1
View File
@@ -310,7 +310,7 @@ export class Server {
* Optimised member fetch route.
* ! OPTIMISATION
*/
async syncMembers() {
async syncMembers(skipOffline?: boolean) {
const data = await this.client.req(
"GET",
`/servers/${this._id}/members` as "/servers/id/members",
@@ -330,6 +330,8 @@ export class Server {
}
}
if (skipOffline) return;
let j = 0;
// Each batch takes between 70 and 90ms.
const batch = () => {