mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
cleanup: fix deepscan issues (#3740)
* fix: don't double check if shards are auto. * fix: remove useless roles array. * fix: remove useless undefined checks. * fix: remove useless `this` binding * Apply suggestions from code review Co-Authored-By: Sugden <28943913+NotSugden@users.noreply.github.com> * Fix: Space's suggestion * Fix: time is always truthy * Check if it's an invalid date. Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
This commit is contained in:
committed by
SpaceEEC
parent
929ff9ccd0
commit
b81f771007
@@ -158,7 +158,7 @@ class WebSocketManager extends EventEmitter {
|
||||
if (shards === 'auto') {
|
||||
this.debug(`Using the recommended shard count provided by Discord: ${recommendedShards}`);
|
||||
this.totalShards = this.client.options.shardCount = recommendedShards;
|
||||
if (shards === 'auto' || !this.client.options.shards.length) {
|
||||
if (!this.client.options.shards.length) {
|
||||
this.client.options.shards = Array.from({ length: recommendedShards }, (_, i) => i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = (client, { d: data }) => {
|
||||
const channel = client.channels.get(data.channel_id);
|
||||
const time = new Date(data.last_pin_timestamp);
|
||||
|
||||
if (channel && time) {
|
||||
if (channel && !Number.isNaN(time.getTime())) {
|
||||
// Discord sends null for last_pin_timestamp if the last pinned message was removed
|
||||
channel.lastPinTimestamp = time.getTime() || null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user