i dont get my code working

i am already struggeling for 3 hours
5 Replies
Alex
AlexOP14mo ago
index.js
const { SapphireClient } = require('@sapphire/framework');
const { GatewayIntentBits } = require('discord.js'); // Fix typo in intent import
const { token, prefix } = require('./config.json');
const { join } = require('path');

const client = new SapphireClient({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages], // Correct intent format
defaultPrefix: prefix,
});

client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});

client.sapphire.commands.addPath(join(__dirname, 'commands'));

client.login(token);
const { SapphireClient } = require('@sapphire/framework');
const { GatewayIntentBits } = require('discord.js'); // Fix typo in intent import
const { token, prefix } = require('./config.json');
const { join } = require('path');

const client = new SapphireClient({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages], // Correct intent format
defaultPrefix: prefix,
});

client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});

client.sapphire.commands.addPath(join(__dirname, 'commands'));

client.login(token);
Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'commands')1
Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'commands')1
That's the error
Favna
Favna14mo ago
client.sapphire doesn't exist, nor do you manually add paths for commands. Please read our guide to learn how to use Sapphire: https://www.sapphirejs.dev/docs/Guide/getting-started/getting-started-with-sapphire (no idea what led you to write that code, whatever gave you the idea that it's correct, is wrong)
Sapphire Framework
Getting started with Sapphire | Sapphire
To install Sapphire, you need to install both discord.js and
Alex
AlexOP14mo ago
Okay thanks, i will check it out @Favna how to add a prefix?
Alex
AlexOP14mo ago
Thanks Hoelang zit je al in de ICT?
Want results from more Discord servers?
Add your server