Trolli
Trolli
DIAdiscord.js - Imagine an app
Created by Trolli on 8/7/2024 in #djs-questions
DiscordAPIError
I've recently begun programming using discord.js and when I try to deploy my commands I get this error:
"C:\Program Files\nodejs\node.exe" C:\Users\user\IdeaProjects\bot\src\deploy-commands.js
node:fs:1507
const result = binding.readdir(
^

Error: ENOTDIR: not a directory, scandir 'C:\Users\user\IdeaProjects\bot\src\commands\loop.command.js'
at Object.readdirSync (node:fs:1507:26)
at Object.<anonymous> (C:\Users\user\IdeaProjects\bot\src\deploy-commands.js:14:29)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
errno: -4052,
code: 'ENOTDIR',
syscall: 'scandir',
path: 'C:\\Users\\user\\IdeaProjects\\bot\\src\\commands\\loop.command.js'
Node.js v20.16.0

Process finished with exit code 1
"C:\Program Files\nodejs\node.exe" C:\Users\user\IdeaProjects\bot\src\deploy-commands.js
node:fs:1507
const result = binding.readdir(
^

Error: ENOTDIR: not a directory, scandir 'C:\Users\user\IdeaProjects\bot\src\commands\loop.command.js'
at Object.readdirSync (node:fs:1507:26)
at Object.<anonymous> (C:\Users\user\IdeaProjects\bot\src\deploy-commands.js:14:29)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
errno: -4052,
code: 'ENOTDIR',
syscall: 'scandir',
path: 'C:\\Users\\user\\IdeaProjects\\bot\\src\\commands\\loop.command.js'
Node.js v20.16.0

Process finished with exit code 1
7 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 9/2/2023 in #djs-questions
Is it possible to check if a user has 2fa enabled?
I've searched around a bit but the only thing I found was mfaenabled
6 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 4/30/2023 in #djs-questions
How do I get the referenced user id from a referenced message?
let prevMessages = await message.channel.messages.fetch({ limit: 15 });
prevMessages.reverse();
await message.channel.sendTyping()

prevMessages.forEach((msg) => {
if (msg.author.id === message.author.id) {
conversationLog.push({
"role": "user",
"content": msg.content
});
} else if (msg.author.bot && /* is a reference to a message sent by the msg.author*/) {
conversationLog.push({
"role": "assistant",
"content": msg.content
});
}
});
let prevMessages = await message.channel.messages.fetch({ limit: 15 });
prevMessages.reverse();
await message.channel.sendTyping()

prevMessages.forEach((msg) => {
if (msg.author.id === message.author.id) {
conversationLog.push({
"role": "user",
"content": msg.content
});
} else if (msg.author.bot && /* is a reference to a message sent by the msg.author*/) {
conversationLog.push({
"role": "assistant",
"content": msg.content
});
}
});
Heres my code
13 replies