mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix presence updating
This commit is contained in:
@@ -31,7 +31,7 @@ class ReadyHandler extends AbstractHandler {
|
||||
client._setPresence(presence.user.id, presence);
|
||||
}
|
||||
|
||||
if (!client.user.bot) client.setInterval(client.syncGuilds.bind(client), 30000);
|
||||
if (!client.user.bot && client.options.sync) client.setInterval(client.syncGuilds.bind(client), 30000);
|
||||
client.once('ready', client.syncGuilds.bind(client));
|
||||
|
||||
if (!client.users.has('1')) {
|
||||
|
||||
@@ -198,6 +198,7 @@ class ClientUser extends User {
|
||||
|
||||
this.localPresence = { status, game, afk };
|
||||
this.localPresence.since = 0;
|
||||
this.localPresence.game = this.localPresence.game || null;
|
||||
|
||||
this.client.ws.send({
|
||||
op: 3,
|
||||
|
||||
@@ -8,6 +8,7 @@ exports.Package = require('../../package.json');
|
||||
* @property {number} [shardId=0] The ID of this shard
|
||||
* @property {number} [shardCount=0] The number of shards
|
||||
* @property {number} [messageCacheMaxSize=200] Maximum number of messages to cache per channel
|
||||
* @property {boolean} [sync=false] Whether to periodically sync guilds
|
||||
* (-1 for unlimited - don't do this without message sweeping, otherwise memory usage will climb indefinitely)
|
||||
* @property {number} [messageCacheLifetime=0] How long until a message should be uncached by the message sweeping
|
||||
* (in seconds, 0 for forever)
|
||||
@@ -34,6 +35,7 @@ exports.DefaultOptions = {
|
||||
disableEveryone: false,
|
||||
restWsBridgeTimeout: 5000,
|
||||
disabledEvents: [],
|
||||
sync: false,
|
||||
|
||||
/**
|
||||
* Websocket options. These are left as snake_case to match the API.
|
||||
|
||||
@@ -8,7 +8,7 @@ const client = new Discord.Client({ fetchAllMembers: false, apiRequestMethod: 's
|
||||
|
||||
const { email, password, token, usertoken, song } = require('./auth.json');
|
||||
|
||||
client.login(token).then(atoken => console.log('logged in with token ' + atoken)).catch(console.error);
|
||||
client.login(usertoken).then(atoken => console.log('logged in with token ' + atoken)).catch(console.error);
|
||||
|
||||
client.ws.on('send', console.log);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user