mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
Make syncGuilds off limits to bot accounts
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -173,12 +173,19 @@ class Client extends EventEmitter {
|
|||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This shouldn't really be necessary to most developers as it is automatically invoked every 30 seconds, however
|
||||||
|
* if you wish to force a sync of Guild data, you can use this. Only applicable to user accounts.
|
||||||
|
* @param {array<Guild>} [guilds=this.guilds.array()] An array of guilds to sync.
|
||||||
|
*/
|
||||||
syncGuilds(guilds = this.guilds.array()) {
|
syncGuilds(guilds = this.guilds.array()) {
|
||||||
|
if (!this.client.user.bot) {
|
||||||
this.ws.send({
|
this.ws.send({
|
||||||
op: 12,
|
op: 12,
|
||||||
d: guilds.map(g => g.id),
|
d: guilds.map(g => g.id),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caches a user, or obtains it from the cache if it's already cached.
|
* Caches a user, or obtains it from the cache if it's already cached.
|
||||||
|
|||||||
@@ -623,11 +623,13 @@ class Guild {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Syncs this guild (already done automatically every 30 seconds)
|
* Syncs this guild (already done automatically every 30 seconds). Only applicable to user accounts.
|
||||||
*/
|
*/
|
||||||
sync() {
|
sync() {
|
||||||
|
if (!this.client.user.bot) {
|
||||||
this.client.syncGuilds([this]);
|
this.client.syncGuilds([this]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = Guild;
|
module.exports = Guild;
|
||||||
|
|||||||
Reference in New Issue
Block a user