bence v12 kullan v13 biraz sıkıntı..Discord.JS V12'ye hakimim, botumum dosyaları silindi. Discord.js v13'e sıfırdan başladım. Mesaj nasıl yazdırabilirim? Discord.PY'ye geçerim belki.
Node.JS ile nasıl v12'yi kurabilirim peki?Bence v12 kullan v13 biraz sıkıntı..
Node.JS ile nasıl v12'yi kurabilirim peki?
npm i [email protected]
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('messageCreate', message => {
if (message.content === 'ping') {
message.channel.send('pong');
}
});
client.login('<place token here>');
Hocam aynı sayılır.Bash:npm i [email protected]
JavaScript:const { Client, Intents } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); client.on('ready', () => { console.log(`Logged in as ${client.user.tag}!`); }); client.on('messageCreate', message => { if (message.content === 'ping') { message.channel.send('pong'); } }); client.login('<place token here>');
Orası / komutlarını da anlatmış.![]()
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.discord.js.org
Hocam buradakiler kafamı karıştırmıştı. v12 ile devam ediyorum.
Orası / komutlarını da anlatmış.
V13 geçseydiniz keşke. / ve buton desteği vardı.
(node:16764) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined
at RequestHandler.execute (C:\vivabot\node_modules\discord.js\src\rest\RequestHandler.js:172:15)
at RequestHandler.execute (C:\vivabot\node_modules\discord.js\src\rest\RequestHandler.js:176:19)
at RequestHandler.push (C:\vivabot\node_modules\discord.js\src\rest\RequestHandler.js:50:25)
at async WebSocketManager.connect (C:\vivabot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:128:9)
at async Client.login (C:\vivabot\node_modules\discord.js\src\client\Client.js:245:7)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16764) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:16764) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
v14 imiş hemen güncelliyorum.Node.js sürümünüz kaç? En az 16 olmalı.
npm i discord.js@12Node.JS ile nasıl v12'yi kurabilirim peki?
Bu sitenin çalışmasını sağlamak için gerekli çerezleri ve deneyiminizi iyileştirmek için isteğe bağlı çerezleri kullanıyoruz.