mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
Make syncGuilds off limits to bot accounts
This commit is contained in:
parent
5af09d335c
commit
16fbbde35c
3 changed files with 16 additions and 7 deletions
File diff suppressed because one or more lines are too long
|
|
@ -173,11 +173,18 @@ class Client extends EventEmitter {
|
|||
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()) {
|
||||
this.ws.send({
|
||||
op: 12,
|
||||
d: guilds.map(g => g.id),
|
||||
});
|
||||
if (!this.client.user.bot) {
|
||||
this.ws.send({
|
||||
op: 12,
|
||||
d: guilds.map(g => g.id),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -623,10 +623,12 @@ 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() {
|
||||
this.client.syncGuilds([this]);
|
||||
if (!this.client.user.bot) {
|
||||
this.client.syncGuilds([this]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue