Lucas
Lucas
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
all of them have a type property
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
and a lot of more
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
{
type: 'string',
name: 'boisson',
description: 'test boire',
required: true,
autocomplete: true
}
{
type: 'string',
name: 'manger',
description: 'test manger',
required: false,
autocomplete: true
}
{
type: 'channel',
name: 'salon',
description: 'Le channel à unlock',
required: true,
autocomplete: false
}
{
type: 'role',
name: 'role',
description: 'Le role à unlock',
required: true,
autocomplete: false
}
{
type: 'string',
name: 'boisson',
description: 'test boire',
required: true,
autocomplete: true
}
{
type: 'string',
name: 'manger',
description: 'test manger',
required: false,
autocomplete: true
}
{
type: 'channel',
name: 'salon',
description: 'Le channel à unlock',
required: true,
autocomplete: false
}
{
type: 'role',
name: 'role',
description: 'Le role à unlock',
required: true,
autocomplete: false
}
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
my options
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
bot.commands = new Discord.Collection()
bot.commands = new Discord.Collection()
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
else slashcommand[`add${command.options[i].type.slice(0, 1).toUpperCase() + command.options[i].type.slice(1, command.options[i].type.length )}Option`](option => option.setName(command.options[i].name).setDescription(command.options[i].description).setRequired(command.options[i].required))
^

TypeError: Cannot read properties of undefined (reading 'slice')
at C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\Loaders\loadSlashCommands.js:22:65
at module.exports (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\Loaders\loadSlashCommands.js:10:18)
at module.exports (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\Events\ready.js:8:11)
at Client.emit (node:events:518:28)
at WebSocketManager.triggerClientReady (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\node_modules\discord.js\src\client\websocket\WebSocketManager.js:388:17)
at WebSocketManager.checkShardsReady (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\node_modules\discord.js\src\client\websocket\WebSocketManager.js:371:10)
at WebSocketShard.<anonymous> (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\node_modules\discord.js\src\client\websocket\WebSocketManager.js:201:16)
at WebSocketShard.emit (node:events:518:28)
at WebSocketShard.checkReady (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\node_modules\discord.js\src\client\websocket\WebSocketShard.js:181:12)
else slashcommand[`add${command.options[i].type.slice(0, 1).toUpperCase() + command.options[i].type.slice(1, command.options[i].type.length )}Option`](option => option.setName(command.options[i].name).setDescription(command.options[i].description).setRequired(command.options[i].required))
^

TypeError: Cannot read properties of undefined (reading 'slice')
at C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\Loaders\loadSlashCommands.js:22:65
at module.exports (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\Loaders\loadSlashCommands.js:10:18)
at module.exports (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\Events\ready.js:8:11)
at Client.emit (node:events:518:28)
at WebSocketManager.triggerClientReady (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\node_modules\discord.js\src\client\websocket\WebSocketManager.js:388:17)
at WebSocketManager.checkShardsReady (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\node_modules\discord.js\src\client\websocket\WebSocketManager.js:371:10)
at WebSocketShard.<anonymous> (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\node_modules\discord.js\src\client\websocket\WebSocketManager.js:201:16)
at WebSocketShard.emit (node:events:518:28)
at WebSocketShard.checkReady (C:\Users\lucas\OneDrive\Bureau\DISCORD OFF BOT\node_modules\discord.js\src\client\websocket\WebSocketShard.js:181:12)
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
Error :
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
+
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
Load Slash Command
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/5/2024 in #djs-questions
Problem with the v14.15.1
const Discord = require("discord.js")
const { REST } = require("@discordjs/rest")
const { Routes } = require("discord.js")


module.exports = async (bot) => {

let commands = [];

bot.commands.forEach( async command => {

let slashcommand = new Discord.SlashCommandBuilder()
.setName(command.name)
.setDescription(command.description)
.setDMPermission(command.dm)
.setDefaultMemberPermissions(command.permission === "Aucune" ? null : command.permission)

if(command.options?.length >= 1) {
for(let i = 0; i < command.options.length; i++) {
console.log(command.options[i])
if(command.options[i].type === "string") slashcommand[`add${command.options[i].type.slice(0, 1).toUpperCase() + command.options[i].type.slice(1, command.options[i].type.length )}Option`](option => option.setName(command.options[i].name).setDescription(command.options[i].description).setAutocomplete(command.options[i].autocomplete).setRequired(command.options[i].required))
else slashcommand[`add${command.options[i].type.slice(0, 1).toUpperCase() + command.options[i].type.slice(1, command.options[i].type.length )}Option`](option => option.setName(command.options[i].name).setDescription(command.options[i].description).setRequired(command.options[i].required))
}
}
await commands.push(slashcommand)
})

const rest = new REST({version: 10}).setToken(bot.token)

await rest.put(Routes.applicationCommands(bot.user.id), {body: commands})
console.log(("[LOAD] - Les slashs commandes sont crées avec succès !!").bold.magenta)
}
const Discord = require("discord.js")
const { REST } = require("@discordjs/rest")
const { Routes } = require("discord.js")


module.exports = async (bot) => {

let commands = [];

bot.commands.forEach( async command => {

let slashcommand = new Discord.SlashCommandBuilder()
.setName(command.name)
.setDescription(command.description)
.setDMPermission(command.dm)
.setDefaultMemberPermissions(command.permission === "Aucune" ? null : command.permission)

if(command.options?.length >= 1) {
for(let i = 0; i < command.options.length; i++) {
console.log(command.options[i])
if(command.options[i].type === "string") slashcommand[`add${command.options[i].type.slice(0, 1).toUpperCase() + command.options[i].type.slice(1, command.options[i].type.length )}Option`](option => option.setName(command.options[i].name).setDescription(command.options[i].description).setAutocomplete(command.options[i].autocomplete).setRequired(command.options[i].required))
else slashcommand[`add${command.options[i].type.slice(0, 1).toUpperCase() + command.options[i].type.slice(1, command.options[i].type.length )}Option`](option => option.setName(command.options[i].name).setDescription(command.options[i].description).setRequired(command.options[i].required))
}
}
await commands.push(slashcommand)
})

const rest = new REST({version: 10}).setToken(bot.token)

await rest.put(Routes.applicationCommands(bot.user.id), {body: commands})
console.log(("[LOAD] - Les slashs commandes sont crées avec succès !!").bold.magenta)
}
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/4/2024 in #djs-questions
Collector problem
but when the time is expired (collector ("end)) that send a message to the channel
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/4/2024 in #djs-questions
Collector problem
the reason to stop the collector is the user who found the number
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/4/2024 in #djs-questions
Collector problem
No description
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/4/2024 in #djs-questions
Collector problem
when the user found the number, i use collector.stop, but i created a collector ("end") so when a user find a number that return two messages
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/4/2024 in #djs-questions
Collector problem
alr that work thanks, but i have another problem
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/4/2024 in #djs-questions
Collector problem
alr lemme try
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/4/2024 in #djs-questions
Collector problem
I did the console.log(randomNumber), to get the number but when i'm typing this number on my server, the bot won't answer to my answer
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/4/2024 in #djs-questions
Collector problem
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Lucas on 5/4/2024 in #djs-questions
Collector problem
i'm french btw
13 replies