Herkese merhaba, ben V14 Discord botu yazmak istiyorum ama hep aynı hatayı alıyorum yardımcı olur musunuz?
(İntents modülünü belirtmeme rağmen)
Kod ise bu:
Const { Client, ıntents } = require('discord.js');
Const Client = New Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
Client. On('messagecreate', message => {
İf (message. Content === 'ping') {
Message. Reply('pong!');
}
});
Hata bu: Const Client = New Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
^
Typeerror: Cannot read properties of undefined (reading 'flags')
At object.<anonymous> (C:\Users\batta\OneDrive\Desktop\panel-bot\index.js:2:47)
At module. _compile (node:internal/modules/cjs/loader:1369:14)
At Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
At module. Load (node:internal/modules/cjs/loader:1206:32)
At module. _load (node:internal/modules/cjs/loader:1022:12)
At function. Executeuserentrypoint [as runMain] (node:internal/modules/run_main:135:12)
At node:internal/main/run_main_module:28:49
Node.js v20.12.2
(İntents modülünü belirtmeme rağmen)
Kod ise bu:
Const { Client, ıntents } = require('discord.js');
Const Client = New Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
Client. On('messagecreate', message => {
İf (message. Content === 'ping') {
Message. Reply('pong!');
}
});
Hata bu: Const Client = New Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
^
Typeerror: Cannot read properties of undefined (reading 'flags')
At object.<anonymous> (C:\Users\batta\OneDrive\Desktop\panel-bot\index.js:2:47)
At module. _compile (node:internal/modules/cjs/loader:1369:14)
At Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
At module. Load (node:internal/modules/cjs/loader:1206:32)
At module. _load (node:internal/modules/cjs/loader:1022:12)
At function. Executeuserentrypoint [as runMain] (node:internal/modules/run_main:135:12)
At node:internal/main/run_main_module:28:49
Node.js v20.12.2