mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
refactor: use the node: protocol (#6710)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const path = require('path');
|
||||
const EventEmitter = require('node:events');
|
||||
const path = require('node:path');
|
||||
const { Error } = require('../errors');
|
||||
const Util = require('../util/Util');
|
||||
let childProcess = null;
|
||||
@@ -21,8 +21,8 @@ class Shard extends EventEmitter {
|
||||
constructor(manager, id) {
|
||||
super();
|
||||
|
||||
if (manager.mode === 'process') childProcess = require('child_process');
|
||||
else if (manager.mode === 'worker') Worker = require('worker_threads').Worker;
|
||||
if (manager.mode === 'process') childProcess = require('node:child_process');
|
||||
else if (manager.mode === 'worker') Worker = require('node:worker_threads').Worker;
|
||||
|
||||
/**
|
||||
* Manager that created the shard
|
||||
|
||||
@@ -44,7 +44,7 @@ class ShardClientUtil {
|
||||
process.send({ _reconnecting: true });
|
||||
});
|
||||
} else if (mode === 'worker') {
|
||||
this.parentPort = require('worker_threads').parentPort;
|
||||
this.parentPort = require('node:worker_threads').parentPort;
|
||||
this.parentPort.on('message', this._handleMessage.bind(this));
|
||||
client.on('ready', () => {
|
||||
this.parentPort.postMessage({ _ready: true });
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const EventEmitter = require('node:events');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const Shard = require('./Shard');
|
||||
const { Error, TypeError, RangeError } = require('../errors');
|
||||
|
||||
Reference in New Issue
Block a user