Discord.js Client objesine Commands adlı özellik ekleme

Katılım
31 Ocak 2022
Mesajlar
209
Daha fazla  
Sistem Özellikleri
CPU: i5-3340 3.10 GHZ
GPU: Amd Radeon R7 240
MotherBoard: H61M-DS2 4.0
RAM: 1x4 4GB DDR3 1333 MHZ
Cinsiyet
Erkek
JavaScript:
import { Client, Collection, GatewayIntentBits } from "discord.js"
require('dotenv').config();
const fs = require('node:fs');
const path = require('node:path');

const client : Client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMembers,
    ],
});

const token = process.env.TOKEN

client.commands = new Collection()
const commandsPath = path.join(__dirname, 'Functions');
const commandFiles = fs.readdirSync(commandsPath).filter((file: string) => file.endsWith('.ts'));

client.login(token)

Kodumun tam hali budur. Typescript dilini ve Discord.js 14.7.1 sürümünü kullanıyorum.
client.commands = new Collection() kısmında ise hata alıyorum. Önceden böyle bir hata yoktu bilgisayara format atıp her şeyi yükleyince oldu.
Hata bu: Property 'commands' does not exist on type 'Client<boolean>
Client objesine bu özelliği vermenin bir yolu var mıdır?
 
JavaScript:
import { Client, Collection, GatewayIntentBits } from "discord.js"
require('dotenv').config();
const fs = require('node:fs');
const path = require('node:path');

const client : Client = new Client({
 intents: [
 GatewayIntentBits.Guilds,
 GatewayIntentBits.GuildMessages,
 GatewayIntentBits.MessageContent,
 GatewayIntentBits.GuildMembers,
 ],
});

const token = process.env.TOKEN

client.commands = new Collection()
const commandsPath = path.join(__dirname, 'Functions');
const commandFiles = fs.readdirSync(commandsPath).filter((file: string) => file.endsWith('.ts'));

client.login(token)

Kodumun tam hali budur. Typescript dilini ve Discord.js 14.7.1 sürümünü kullanıyorum.
client.commands = new Collection() kısmında ise hata alıyorum. Önceden böyle bir hata yoktu bilgisayara format atıp her şeyi yükleyince oldu.
Hata bu: Property 'commands' does not exist on type 'Client<boolean>
Client objesine bu özelliği vermenin bir yolu var mıdır?

ayarlar.js açıp değişken mi atadınız yoksa tokeni direk burayamı girdiniz?
 

Geri
Yukarı