Duff
Duff
DIAdiscord.js - Imagine an app
Created by Duff on 6/25/2023 in #djs-questions
Quick question: would a bot be able to block a user from editing a message? Or is there a way?
^^
10 replies
DIAdiscord.js - Imagine an app
Created by Duff on 6/19/2023 in #djs-questions
Why does this code result in the screenshot?
2 replies
DIAdiscord.js - Imagine an app
Created by Duff on 6/9/2023 in #djs-questions
How do I fix this? It bugs on some users and idk why?
4 replies
DIAdiscord.js - Imagine an app
Created by Duff on 6/6/2023 in #djs-questions
Can anyone tell me where this is coming from?
9 replies
DIAdiscord.js - Imagine an app
Created by Duff on 4/10/2023 in #djs-questions
Slash command for 1 user?
Is it possible to make a slash command visible to only 1 user? I basicly want to add a restart command however I don't want others servers the bot is in to see this too. Can i make it only for me? If not, how should i implement this then?
6 replies
DIAdiscord.js - Imagine an app
Created by Duff on 4/3/2023 in #djs-questions
How do I fetch a member?
4 replies
DIAdiscord.js - Imagine an app
Created by Duff on 4/2/2023 in #djs-questions
Error
// Place your client and guild ids here
const clientId = clientID;
const guildId = guildID;
const foldersPath = path.join(__dirname, 'Commands');
const commandFolders = fs.readdirSync(foldersPath);

for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
// Set a new item in the Collection with the key as the command name and the value as the exported module
if ('data' in command && 'executeInteraction' in command) {
client.commands.set(command.data.name, command);
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

// ---> Rest for slash commands
const rest = new REST({ version: '10' }).setToken(token);

(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(clientId),
{ 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);
}
})();
// Place your client and guild ids here
const clientId = clientID;
const guildId = guildID;
const foldersPath = path.join(__dirname, 'Commands');
const commandFolders = fs.readdirSync(foldersPath);

for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
// Set a new item in the Collection with the key as the command name and the value as the exported module
if ('data' in command && 'executeInteraction' in command) {
client.commands.set(command.data.name, command);
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

// ---> Rest for slash commands
const rest = new REST({ version: '10' }).setToken(token);

(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(clientId),
{ 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);
}
})();
8 replies
DIAdiscord.js - Imagine an app
Created by Duff on 3/31/2023 in #djs-questions
Interaction aint saving
// ---> Adding the needed collections
const commands = [];
//client.commands = new Discord.Collection();

// Place your client and guild ids here
const clientId = clientID;
const guildId = guildID;

// ---> Reads the command files
const commandFiles = fs.readdirSync('./Commands')

for (const folder of commandFiles) {
const commandFiles = fs.readdirSync(`./Commands/${folder}`).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./Commands/${folder}/${file}`);
if (command.data) { commands.push(command.data.toJSON()); }
}
}

// ---> Rest for slash commands
const rest = new REST({ version: '10' }).setToken(token);

(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(clientId, guildId),
{ 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);
}
})();
// ---> Adding the needed collections
const commands = [];
//client.commands = new Discord.Collection();

// Place your client and guild ids here
const clientId = clientID;
const guildId = guildID;

// ---> Reads the command files
const commandFiles = fs.readdirSync('./Commands')

for (const folder of commandFiles) {
const commandFiles = fs.readdirSync(`./Commands/${folder}`).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./Commands/${folder}/${file}`);
if (command.data) { commands.push(command.data.toJSON()); }
}
}

// ---> Rest for slash commands
const rest = new REST({ version: '10' }).setToken(token);

(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(clientId, guildId),
{ 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);
}
})();
4 replies
DIAdiscord.js - Imagine an app
Created by Duff on 3/30/2023 in #djs-questions
Error
8 replies