mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
refactor(Bitfield): use discord-api-types enums instead (#7313)
Co-authored-by: Almeida <almeidx@pm.me>
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert');
|
||||
const { ChannelType } = require('discord-api-types/v9');
|
||||
const { ChannelType, GatewayIntentBits } = require('discord-api-types/v9');
|
||||
const { token } = require('./auth');
|
||||
const { Client, Intents } = require('../src');
|
||||
const { Client } = require('../src');
|
||||
|
||||
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
|
||||
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
|
||||
|
||||
client.on('ready', async () => {
|
||||
try {
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
const request = require('superagent');
|
||||
const ytdl = require('ytdl-core');
|
||||
const { token, song } = require('./auth.js');
|
||||
const { Client, Intents } = require('../src');
|
||||
const { ChannelType } = require('discord-api-types/v9');
|
||||
const { Client } = require('../src');
|
||||
const { ChannelType, GatewayIntentBits } = require('discord-api-types/v9');
|
||||
|
||||
console.time('magic');
|
||||
|
||||
const client = new Client({
|
||||
intents: [
|
||||
Intents.FLAGS.GUILDS,
|
||||
Intents.FLAGS.GUILD_MESSAGES,
|
||||
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
|
||||
Intents.FLAGS.GUILD_MEMBERS,
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.GuildMessageReactions,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const { GatewayIntentBits } = require('discord-api-types/v9');
|
||||
const { token, guildId, channelId, messageId } = require('./auth.js');
|
||||
const { Client, Intents, ReactionCollector } = require('../src');
|
||||
const { Client, ReactionCollector } = require('../src');
|
||||
|
||||
const client = new Client({
|
||||
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS],
|
||||
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions],
|
||||
});
|
||||
|
||||
client.on('ready', async () => {
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const fetch = require('node-fetch');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const process = require('node:process');
|
||||
const { setTimeout: sleep } = require('node:timers/promises');
|
||||
const util = require('node:util');
|
||||
const { GatewayIntentBits } = require('discord-api-types/v9');
|
||||
const fetch = require('node-fetch');
|
||||
const { owner, token } = require('./auth.js');
|
||||
const { Client, Intents, MessageAttachment, Embed } = require('../src');
|
||||
const { Client, MessageAttachment, Embed } = require('../src');
|
||||
|
||||
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
|
||||
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
|
||||
|
||||
const buffer = l => fetch(l).then(res => res.buffer());
|
||||
const read = util.promisify(fs.readFile);
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
const process = require('node:process');
|
||||
const { setTimeout } = require('node:timers');
|
||||
const { GatewayIntentBits } = require('discord-api-types/v9');
|
||||
const { token } = require('./auth.json');
|
||||
const { Client, Intents } = require('../src');
|
||||
const { Client } = require('../src');
|
||||
|
||||
const client = new Client({
|
||||
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
|
||||
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
|
||||
shards: process.argv[2],
|
||||
shardCount: process.argv[3],
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const { token } = require('./auth');
|
||||
const { Client } = require('../src');
|
||||
const { Client, GatewayIntentBits } = require('../src');
|
||||
|
||||
const client = new Client({ intents: ['GUILDS', 'GUILD_MESSAGES'] });
|
||||
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
|
||||
client
|
||||
.on('ready', () => console.log('ready'))
|
||||
.on('messageCreate', async message => {
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const { GatewayIntentBits } = require('discord-api-types/v9');
|
||||
const { token, prefix, owner } = require('./auth.js');
|
||||
const { Client, Intents } = require('../src');
|
||||
const { Client } = require('../src');
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const log = (...args) => console.log(process.uptime().toFixed(3), ...args);
|
||||
|
||||
const client = new Client({
|
||||
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
|
||||
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
|
||||
shardCount: 2,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const { GatewayIntentBits } = require('discord-api-types/v9');
|
||||
const { token, prefix, owner } = require('./auth.js');
|
||||
const { Client, Options, Intents, Formatters } = require('../src');
|
||||
const { Client, Options, Formatters } = require('../src');
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const log = (...args) => console.log(process.uptime().toFixed(3), ...args);
|
||||
|
||||
const client = new Client({
|
||||
// 😏
|
||||
intents: Object.values(Intents.FLAGS).reduce((acc, p) => acc | p, 0),
|
||||
intents: Object.values(GatewayIntentBits).reduce((acc, p) => acc | p, 0),
|
||||
makeCache: Options.cacheWithLimits({
|
||||
MessageManager: 10,
|
||||
PresenceManager: 10,
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
const fetch = require('node-fetch');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { setTimeout: sleep } = require('node:timers/promises');
|
||||
const util = require('node:util');
|
||||
const { GatewayIntentBits } = require('discord-api-types/v9');
|
||||
const fetch = require('node-fetch');
|
||||
const { owner, token, webhookChannel, webhookToken } = require('./auth.js');
|
||||
const { Client, Intents, MessageAttachment, Embed, WebhookClient } = require('../src');
|
||||
const { Client, MessageAttachment, Embed, WebhookClient } = require('../src');
|
||||
|
||||
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
|
||||
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
|
||||
|
||||
const buffer = l => fetch(l).then(res => res.buffer());
|
||||
const read = util.promisify(fs.readFile);
|
||||
|
||||
Reference in New Issue
Block a user