mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-21 08:54:41 +12:00
refactor: use the node:
protocol (#6710)
This commit is contained in:
parent
466e796a1d
commit
531b46c60d
17 changed files with 28 additions and 28 deletions
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const EventEmitter = require('node:events');
|
||||
const RESTManager = require('../rest/RESTManager');
|
||||
const Options = require('../util/Options');
|
||||
const Util = require('../util/Util');
|
||||
|
|
|
@ -37,7 +37,7 @@ class Client extends BaseClient {
|
|||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
const data = require('worker_threads').workerData ?? process.env;
|
||||
const data = require('node:worker_threads').workerData ?? process.env;
|
||||
const defaults = Options.createDefault();
|
||||
|
||||
if (this.options.shards === defaults.shards) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
class ActionsManager {
|
||||
constructor(client) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const EventEmitter = require('node:events');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { RPCErrorCodes } = require('discord-api-types/v9');
|
||||
const WebSocketShard = require('./WebSocketShard');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const EventEmitter = require('node:events');
|
||||
const WebSocket = require('../../WebSocket');
|
||||
const { Status, Events, ShardEvents, Opcodes, WSEvents } = require('../../util/Constants');
|
||||
const Intents = require('../../util/Intents');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const https = require('https');
|
||||
const https = require('node:https');
|
||||
const FormData = require('@discordjs/form-data');
|
||||
const fetch = require('node-fetch');
|
||||
const { UserAgent } = require('../util/Constants');
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const EventEmitter = require('node:events');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { TypeError } = require('../../errors');
|
||||
const Util = require('../../util/Util');
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const stream = require('stream');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const stream = require('node:stream');
|
||||
const fetch = require('node-fetch');
|
||||
const { Error: DiscordError, TypeError } = require('../errors');
|
||||
const Invite = require('../structures/Invite');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const { parse } = require('path');
|
||||
const { parse } = require('node:path');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const fetch = require('node-fetch');
|
||||
const { Colors, Endpoints } = require('./Constants');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const assert = require('node:assert');
|
||||
const { token } = require('./auth');
|
||||
const { Client, Intents } = require('../src');
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const util = require('node:util');
|
||||
const fetch = require('node-fetch');
|
||||
const { owner, token } = require('./auth.js');
|
||||
const { Client, Intents, MessageAttachment, MessageEmbed } = require('../src');
|
||||
|
|
|
@ -24,7 +24,7 @@ const commands = {
|
|||
let res;
|
||||
try {
|
||||
res = eval(message.content);
|
||||
if (typeof res !== 'string') res = require('util').inspect(res);
|
||||
if (typeof res !== 'string') res = require('node:util').inspect(res);
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err.stack);
|
||||
|
|
|
@ -36,7 +36,7 @@ const commands = {
|
|||
let res;
|
||||
try {
|
||||
res = eval(message.content);
|
||||
if (typeof res !== 'string') res = require('util').inspect(res);
|
||||
if (typeof res !== 'string') res = require('node:util').inspect(res);
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err.stack);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const util = require('node:util');
|
||||
const fetch = require('node-fetch');
|
||||
const { owner, token, webhookChannel, webhookToken } = require('./auth.js');
|
||||
const { Client, Intents, MessageAttachment, MessageEmbed, WebhookClient } = require('../src');
|
||||
|
|
Loading…
Reference in a new issue