mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
Switch config back to camelCase
This commit is contained in:
@@ -29,12 +29,12 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
this.options = mergeDefault(Constants.DefaultOptions, options);
|
||||
|
||||
if (!this.options.shard_id && 'SHARD_ID' in process.env) {
|
||||
this.options.shard_id = Number(process.env.SHARD_ID);
|
||||
if (!this.options.shardId && 'SHARD_ID' in process.env) {
|
||||
this.options.shardId = Number(process.env.SHARD_ID);
|
||||
}
|
||||
|
||||
if (!this.options.shard_count && 'SHARD_COUNT' in process.env) {
|
||||
this.options.shard_count = Number(process.env.SHARD_COUNT);
|
||||
if (!this.options.shardCount && 'SHARD_COUNT' in process.env) {
|
||||
this.options.shardCount = Number(process.env.SHARD_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,8 +150,8 @@ class Client extends EventEmitter {
|
||||
this._timeouts = new Set();
|
||||
this._intervals = new Set();
|
||||
|
||||
if (this.options.message_sweep_interval > 0) {
|
||||
this.setInterval(this.sweepMessages.bind(this), this.options.message_sweep_interval * 1000);
|
||||
if (this.options.messageSweepInterval > 0) {
|
||||
this.setInterval(this.sweepMessages.bind(this), this.options.messageSweepInterval * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,12 +273,12 @@ class Client extends EventEmitter {
|
||||
/**
|
||||
* Sweeps all channels' messages and removes the ones older than the max message lifetime.
|
||||
* If the message has been edited, the time of the edit is used rather than the time of the original message.
|
||||
* @param {number} [lifetime=this.options.message_cache_lifetime] Messages that are older than this (in seconds)
|
||||
* will be removed from the caches. The default is based on the client's `message_cache_lifetime` option.
|
||||
* @param {number} [lifetime=this.options.messageCacheLifetime] Messages that are older than this (in seconds)
|
||||
* will be removed from the caches. The default is based on the client's `messageCacheLifetime` option.
|
||||
* @returns {number} Amount of messages that were removed from the caches,
|
||||
* or -1 if the message cache lifetime is unlimited
|
||||
*/
|
||||
sweepMessages(lifetime = this.options.message_cache_lifetime) {
|
||||
sweepMessages(lifetime = this.options.messageCacheLifetime) {
|
||||
if (typeof lifetime !== 'number' || isNaN(lifetime)) throw new TypeError('Lifetime must be a number.');
|
||||
if (lifetime <= 0) {
|
||||
this.emit('debug', 'Didn\'t sweep messages - lifetime is unlimited');
|
||||
|
||||
@@ -27,7 +27,7 @@ class ClientDataManager {
|
||||
* @event Client#guildCreate
|
||||
* @param {Guild} guild The created guild
|
||||
*/
|
||||
if (this.client.options.fetch_all_members) {
|
||||
if (this.client.options.fetchAllMembers) {
|
||||
guild.fetchMembers().then(() => { this.client.emit(Constants.Events.GUILD_CREATE, guild); });
|
||||
} else {
|
||||
this.client.emit(Constants.Events.GUILD_CREATE, guild);
|
||||
|
||||
@@ -24,7 +24,7 @@ class ChannelDeleteAction extends Action {
|
||||
}
|
||||
|
||||
scheduleForDeletion(id) {
|
||||
this.client.setTimeout(() => this.deleted.delete(id), this.client.options.rest_ws_bridge_timeout);
|
||||
this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class GuildDeleteAction extends Action {
|
||||
}
|
||||
|
||||
scheduleForDeletion(id) {
|
||||
this.client.setTimeout(() => this.deleted.delete(id), this.client.options.rest_ws_bridge_timeout);
|
||||
this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class GuildMemberRemoveAction extends Action {
|
||||
}
|
||||
|
||||
scheduleForDeletion(guildID, userID) {
|
||||
this.client.setTimeout(() => this.deleted.delete(guildID + userID), this.client.options.rest_ws_bridge_timeout);
|
||||
this.client.setTimeout(() => this.deleted.delete(guildID + userID), this.client.options.restWsBridgeTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class GuildRoleDeleteAction extends Action {
|
||||
}
|
||||
|
||||
scheduleForDeletion(guildID, roleID) {
|
||||
this.client.setTimeout(() => this.deleted.delete(guildID + roleID), this.client.options.rest_ws_bridge_timeout);
|
||||
this.client.setTimeout(() => this.deleted.delete(guildID + roleID), this.client.options.restWsBridgeTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class MessageDeleteAction extends Action {
|
||||
|
||||
scheduleForDeletion(channelID, messageID) {
|
||||
this.client.setTimeout(() => this.deleted.delete(channelID + messageID),
|
||||
this.client.options.rest_ws_bridge_timeout);
|
||||
this.client.options.restWsBridgeTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class RESTManager {
|
||||
}
|
||||
|
||||
getRequestHandler() {
|
||||
switch (this.client.options.api_request_method) {
|
||||
switch (this.client.options.apiRequestMethod) {
|
||||
case 'sequential':
|
||||
return SequentialRequestHandler;
|
||||
case 'burst':
|
||||
|
||||
@@ -41,18 +41,18 @@ class RESTMethods {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.rest.makeRequest('get', Constants.Endpoints.gateway, true)
|
||||
.then(res => {
|
||||
this.rest.client.ws.gateway = `${res.url}/?encoding=json&v=${this.rest.client.options.protocol_version}`;
|
||||
this.rest.client.ws.gateway = `${res.url}/?encoding=json&v=${this.rest.client.options.protocolVersion}`;
|
||||
resolve(this.rest.client.ws.gateway);
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
sendMessage(channel, content, { tts, nonce, disable_everyone, split } = {}, file = null) {
|
||||
sendMessage(channel, content, { tts, nonce, disableEveryone, split } = {}, file = null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (typeof content !== 'undefined') content = this.rest.client.resolver.resolveString(content);
|
||||
|
||||
if (disable_everyone || (typeof disable_everyone === 'undefined' && this.rest.client.options.disable_everyone)) {
|
||||
if (disableEveryone || (typeof disableEveryone === 'undefined' && this.rest.client.options.disableEveryone)) {
|
||||
content = content.replace('@everyone', '@\u200beveryone').replace('@here', '@\u200bhere');
|
||||
}
|
||||
|
||||
|
||||
@@ -171,8 +171,8 @@ class WebSocketManager extends EventEmitter {
|
||||
this.reconnecting = false;
|
||||
const payload = this.client.options.ws;
|
||||
payload.token = this.client.token;
|
||||
if (this.client.options.shard_count > 0) {
|
||||
payload.shard = [Number(this.client.options.shard_id), Number(this.client.options.shard_count)];
|
||||
if (this.client.options.shardCount > 0) {
|
||||
payload.shard = [Number(this.client.options.shardId), Number(this.client.options.shardCount)];
|
||||
}
|
||||
this.client.emit('debug', 'Identifying as new session');
|
||||
this.send({
|
||||
@@ -256,7 +256,7 @@ class WebSocketManager extends EventEmitter {
|
||||
}
|
||||
if (unavailableCount === 0) {
|
||||
this.status = Constants.Status.NEARLY;
|
||||
if (this.client.options.fetch_all_members) {
|
||||
if (this.client.options.fetchAllMembers) {
|
||||
const promises = this.client.guilds.array().map(g => g.fetchMembers());
|
||||
Promise.all(promises).then(() => this._emitReady()).catch(e => {
|
||||
this.client.emit(Constants.Event.WARN, `Error on pre-ready guild member fetching - ${e}`);
|
||||
|
||||
Reference in New Issue
Block a user