Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@
"runkitExampleFilename": "./docs/examples/ping.js",
"unpkg": "./webpack/discord.min.js",
"dependencies": {
"@discordjs/collection": "^0.1.1",
"@discordjs/collection": "^0.1.5",
"abort-controller": "^3.0.0",
"form-data": "^2.3.3",
"node-fetch": "^2.3.0",
"prism-media": "^1.0.0",
"form-data": "^3.0.0",
"node-fetch": "^2.6.0",
"prism-media": "^1.2.0",
"setimmediate": "^1.0.5",
"tweetnacl": "^1.0.1",
"ws": "^7.2.0"
"tweetnacl": "^1.0.3",
"ws": "^7.2.1"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"erlpack": "discordapp/erlpack",
"libsodium-wrappers": "^0.7.4",
"libsodium-wrappers": "^0.7.6",
"sodium": "^3.0.2",
"utf-8-validate": "^5.0.2",
"zlib-sync": "^0.1.6"
Expand All @@ -74,20 +74,20 @@
},
"devDependencies": {
"@types/node": "^10.12.24",
"@types/ws": "^6.0.1",
"@types/ws": "^7.2.1",
"discord.js-docgen": "discordjs/docgen",
"dtslint": "^3.0.0",
"eslint": "^5.13.0",
"jest": "^24.7.1",
"eslint": "^6.8.0",
"jest": "^25.1.0",
"json-filter-loader": "^1.0.0",
"terser-webpack-plugin": "^1.2.2",
"tslint": "^5.12.1",
"typescript": "^3.3.3",
"webpack": "^4.29.3",
"webpack-cli": "^3.2.3"
"tslint": "^6.0.0",
"typescript": "^3.8.2",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11"
},
"engines": {
"node": ">=11.0.0"
"node": ">=12.0.0"
},
"browser": {
"@discordjs/opus": false,
Expand Down
2 changes: 1 addition & 1 deletion src/client/voice/util/VolumeInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ exports.applyToClass = function applyToClass(structure) {
Object.defineProperty(
structure.prototype,
prop,
Object.getOwnPropertyDescriptor(VolumeInterface.prototype, prop)
Object.getOwnPropertyDescriptor(VolumeInterface.prototype, prop),
);
}
};
4 changes: 2 additions & 2 deletions src/client/websocket/handlers/GUILD_CREATE.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = async (client, { d: data }, shard) => {
// If the client was ready before and we had unavailable guilds, fetch them
if (client.ws.status === Status.READY && client.options.fetchAllMembers) {
await guild.members.fetch().catch(err =>
client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`)
client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`),
);
}
}
Expand All @@ -27,7 +27,7 @@ module.exports = async (client, { d: data }, shard) => {
*/
if (client.options.fetchAllMembers) {
await guild.members.fetch().catch(err =>
client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`)
client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`),
);
}
client.emit(Events.GUILD_CREATE, guild);
Expand Down
6 changes: 3 additions & 3 deletions src/rest/RequestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class RequestHandler {
// NodeFetch error expected for all "operational" errors, such as 500 status code
this.busy = false;
return reject(
new HTTPError(error.message, error.constructor.name, error.status, request.method, request.path)
new HTTPError(error.message, error.constructor.name, error.status, request.method, request.path),
);
}

Expand Down Expand Up @@ -155,7 +155,7 @@ class RequestHandler {
// Retry the specified number of times for possible serverside issues
if (item.retries === this.manager.client.options.retryLimit) {
return reject(
new HTTPError(res.statusText, res.constructor.name, res.status, item.request.method, request.path)
new HTTPError(res.statusText, res.constructor.name, res.status, item.request.method, request.path),
);
} else {
item.retries++;
Expand All @@ -172,7 +172,7 @@ class RequestHandler {
return null;
} catch (err) {
return reject(
new HTTPError(err.message, err.constructor.name, err.status, request.method, request.path)
new HTTPError(err.message, err.constructor.name, err.status, request.method, request.path),
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/sharding/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class Shard extends EventEmitter {
if (message._sFetchProp) {
this.manager.fetchClientValues(message._sFetchProp).then(
results => this.send({ _sFetchProp: message._sFetchProp, _result: results }),
err => this.send({ _sFetchProp: message._sFetchProp, _error: Util.makePlainError(err) })
err => this.send({ _sFetchProp: message._sFetchProp, _error: Util.makePlainError(err) }),
);
return;
}
Expand All @@ -303,7 +303,7 @@ class Shard extends EventEmitter {
if (message._sEval) {
this.manager.broadcastEval(message._sEval).then(
results => this.send({ _sEval: message._sEval, _result: results }),
err => this.send({ _sEval: message._sEval, _error: Util.makePlainError(err) })
err => this.send({ _sEval: message._sEval, _error: Util.makePlainError(err) }),
);
return;
}
Expand Down
10 changes: 5 additions & 5 deletions src/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ class Guild extends Base {
user: this.client.users.add(ban.user),
});
return collection;
}, new Collection())
}, new Collection()),
);
}

Expand All @@ -634,7 +634,7 @@ class Guild extends Base {
return this.client.api.guilds(this.id).integrations.get().then(data =>
data.reduce((collection, integration) =>
collection.set(integration.id, new Integration(this.client, integration, this)),
new Collection())
new Collection()),
);
}

Expand Down Expand Up @@ -1086,7 +1086,7 @@ class Guild extends Base {
this.client.actions.GuildChannelsPositionUpdate.handle({
guild_id: this.id,
channels: updatedChannels,
}).guild
}).guild,
);
}

Expand Down Expand Up @@ -1120,7 +1120,7 @@ class Guild extends Base {
this.client.actions.GuildRolePositionUpdate.handle({
guild_id: this.id,
roles: rolePositions,
}).guild
}).guild,
);
}

Expand Down Expand Up @@ -1250,7 +1250,7 @@ class Guild extends Base {
_sortedChannels(channel) {
const category = channel.type === ChannelTypes.CATEGORY;
return Util.discordSort(this.channels.cache.filter(c =>
c.type === channel.type && (category || c.parent === channel.parent)
c.type === channel.type && (category || c.parent === channel.parent),
));
}
}
Expand Down
1 change: 1 addition & 0 deletions src/structures/GuildChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ class GuildChannel extends Channel {
*/
setParent(channel, { lockPermissions = true, reason } = {}) {
return this.edit({
// eslint-disable-next-line no-prototype-builtins
parentID: channel !== null ? channel.hasOwnProperty('id') ? channel.id : channel : null,
lockPermissions,
}, reason);
Expand Down
8 changes: 4 additions & 4 deletions src/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Message extends Base {
if (data.attachments) {
for (const attachment of data.attachments) {
this.attachments.set(attachment.id, new MessageAttachment(
attachment.url, attachment.filename, attachment
attachment.url, attachment.filename, attachment,
));
}
}
Expand Down Expand Up @@ -230,7 +230,7 @@ class Message extends Base {
this.attachments = new Collection();
for (const attachment of data.attachments) {
this.attachments.set(attachment.id, new MessageAttachment(
attachment.url, attachment.filename, attachment
attachment.url, attachment.filename, attachment,
));
}
} else {
Expand All @@ -242,7 +242,7 @@ class Message extends Base {
'mentions' in data ? data.mentions : this.mentions.users,
'mentions_roles' in data ? data.mentions_roles : this.mentions.roles,
'mention_everyone' in data ? data.mention_everyone : this.mentions.everyone,
'mention_channels' in data ? data.mention_channels : this.mentions.crosspostedChannels
'mention_channels' in data ? data.mention_channels : this.mentions.crosspostedChannels,
);

this.flags = new MessageFlags('flags' in data ? data.flags : 0).freeze();
Expand Down Expand Up @@ -511,7 +511,7 @@ class Message extends Base {
reply(content, options) {
return this.channel.send(content instanceof APIMessage ?
content :
APIMessage.transformOptions(content, options, { reply: this.member || this.author })
APIMessage.transformOptions(content, options, { reply: this.member || this.author }),
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/structures/interfaces/TextBasedChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class TextBasedChannel {
let messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id || m);
if (filterOld) {
messageIDs = messageIDs.filter(id =>
Date.now() - Snowflake.deconstruct(id).date.getTime() < 1209600000
Date.now() - Snowflake.deconstruct(id).date.getTime() < 1209600000,
);
}
if (messageIDs.length === 0) return new Collection();
Expand Down Expand Up @@ -336,7 +336,7 @@ class TextBasedChannel {
'typing',
'typingCount',
'createMessageCollector',
'awaitMessages'
'awaitMessages',
);
}
for (const prop of props) {
Expand Down
2 changes: 1 addition & 1 deletion src/util/Snowflake.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SnowflakeUtil {
if (timestamp instanceof Date) timestamp = timestamp.getTime();
if (typeof timestamp !== 'number' || isNaN(timestamp)) {
throw new TypeError(
`"timestamp" argument must be a number (received ${isNaN(timestamp) ? 'NaN' : typeof timestamp})`
`"timestamp" argument must be a number (received ${isNaN(timestamp) ? 'NaN' : typeof timestamp})`,
);
}
if (INCREMENT >= 4095) INCREMENT = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/util/Structures.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Structures {
if (typeof extender !== 'function') {
const received = `(received ${typeof extender})`;
throw new TypeError(
`"extender" argument must be a function that returns the extended structure class/prototype ${received}.`
`"extender" argument must be a function that returns the extended structure class/prototype ${received}.`,
);
}

Expand All @@ -60,7 +60,7 @@ class Structures {
const received = `${extended.name || 'unnamed'}${prototype.name ? ` extends ${prototype.name}` : ''}`;
throw new Error(
'The class/prototype returned from the extender function must extend the existing structure class/prototype' +
` (received function ${received}; expected extension of ${structures[structure].name}).`
` (received function ${received}; expected extension of ${structures[structure].name}).`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/util/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ class Util {
return collection.sorted((a, b) =>
a.rawPosition - b.rawPosition ||
parseInt(b.id.slice(0, -10)) - parseInt(a.id.slice(0, -10)) ||
parseInt(b.id.slice(10)) - parseInt(a.id.slice(10))
parseInt(b.id.slice(10)) - parseInt(a.id.slice(10)),
);
}

Expand Down