AutiCodes
AutiCodes
Explore posts from servers
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
Ahh clear!
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
Im familair with PHP / Python structures, totaly not with JS
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
I saw a tutorial, touch it needed in the src
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
Is works now, howkey, weurd
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
I try different directory
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
Now i wonder it to
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
Control + S inside the file i did to, and restarted VScode
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
He does see it still as Client.login
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
I did save my code and rebooted VScode
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
Ohw, now i get client.login is not a function Code i use:
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});

client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`)
})

client.on("message", msg => {
if (msg.content === "ping") {
msg.reply("pong");
}
})

client.login('tokenIdidHere')
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});

client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`)
})

client.on("message", msg => {
if (msg.content === "ping") {
msg.reply("pong");
}
})

client.login('tokenIdidHere')
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 8/12/2023 in #djs-questions
Cannot read properties of undefined (reading 'Client')
[email protected] - Node.js v18.16.0
22 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 4/24/2023 in #djs-questions
Error: ENOTDIR: not a directory, scandir 'C:\Users\k_der\developing\JS\bots\commands\ping.js'
You're a hero for your help!
33 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 4/24/2023 in #djs-questions
Error: ENOTDIR: not a directory, scandir 'C:\Users\k_der\developing\JS\bots\commands\ping.js'
Jeeej
33 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 4/24/2023 in #djs-questions
Error: ENOTDIR: not a directory, scandir 'C:\Users\k_der\developing\JS\bots\commands\ping.js'
Thank you so mutch! I did make that he goed trough every file tho, for ez use:
const { REST, Routes } = require('discord.js');
const fs = require('node:fs');
const path = require('node:path');

const commands = [];

const foldersPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(foldersPath).filter(file => file.endsWith('.js'));


// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(foldersPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken("T");

// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands("1099710952766705794", "1002208148930691172"),
{ body: commands },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
const { REST, Routes } = require('discord.js');
const fs = require('node:fs');
const path = require('node:path');

const commands = [];

const foldersPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(foldersPath).filter(file => file.endsWith('.js'));


// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(foldersPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken("T");

// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands("1099710952766705794", "1002208148930691172"),
{ body: commands },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
I got: Started refreshing 3 application (/) commands. Successfully reloaded 3 application (/) commands.
33 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 4/24/2023 in #djs-questions
Error: ENOTDIR: not a directory, scandir 'C:\Users\k_der\developing\JS\bots\commands\ping.js'
That was the issue!
33 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 4/24/2023 in #djs-questions
Error: ENOTDIR: not a directory, scandir 'C:\Users\k_der\developing\JS\bots\commands\ping.js'
Uhhm no 🥺 whoops
33 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 4/24/2023 in #djs-questions
Error: ENOTDIR: not a directory, scandir 'C:\Users\k_der\developing\JS\bots\commands\ping.js'
Good one, gonna check
33 replies
DIAdiscord.js - Imagine a boo! 👻
Created by AutiCodes on 4/24/2023 in #djs-questions
Error: ENOTDIR: not a directory, scandir 'C:\Users\k_der\developing\JS\bots\commands\ping.js'
33 replies