</JustTheDev>
</JustTheDev>
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 3/21/2024 in #djs-questions
Send me dm on every message
I want the bot to send me a dm with the user name, id and the message. I just want 1 index.js file and no other commands
5 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 3/20/2024 in #djs-questions
Premium only command
I want to make a command that checks if you have the premium role in a specific guild (i already added that guilds id to config.json) and then it adds the interaction user id to the json database with the value "true" so the bot can check it with other commands for premium only commands
9 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 3/20/2024 in #djs-questions
Live count cmd
I want to make a slash command that updates a voice channel that it has created before every 10 minutes with the current member count of that server Edit: every 24h instead of 10 minutes
5 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 3/20/2024 in #djs-questions
deploy-commands.js stopped working without errors
It takes forever to reload 5 commands
19 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 3/14/2024 in #djs-questions
Restart every 1 hour
I want to make a function that restarts the bot every 1 hour, is this possible? And if its possible how?
8 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 3/6/2024 in #djs-questions
Help me pls
Code: Error: [WARNING] The command at C:\Users\OE104655\Videos\Eendsmp bot\commands\utility\giveaway.js is missing a required "data" or "execute" property.
12 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 3/6/2024 in #djs-questions
Help me pls
Idk whats wrong with this line of code: const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessageReactions] });
5 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 3/6/2024 in #djs-questions
is it possible to run command 1 from command 2
so like command 1 is /embed title: description: And i want to run that command with pre-set values from /announcements
3 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 3/5/2024 in #djs-questions
/embed not working
Code:
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Create an embed')
.addStringOption(option =>
option.setName('title')
.setDescription('Title of the embed')
.setRequired(true))
.addStringOption(option =>
option.setName('description')
.setDescription('Description of the embed')
.setRequired(true))
.addStringOption(option =>
option.setName('color')
.setDescription('Color of the embed in HEX format (e.g., #FF0000)')
.setRequired(false)),
async execute(interaction) {
const { options } = interaction;
const title = options.getString('title');
const description = options.getString('description');
const color = options.getString('color');

const embed = {
title: title,
description: description,
color: color ? color.replace('#', '') : 'RANDOM' // If color is not provided, use random color
};

await interaction.reply({ embeds: [embed] });
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Create an embed')
.addStringOption(option =>
option.setName('title')
.setDescription('Title of the embed')
.setRequired(true))
.addStringOption(option =>
option.setName('description')
.setDescription('Description of the embed')
.setRequired(true))
.addStringOption(option =>
option.setName('color')
.setDescription('Color of the embed in HEX format (e.g., #FF0000)')
.setRequired(false)),
async execute(interaction) {
const { options } = interaction;
const title = options.getString('title');
const description = options.getString('description');
const color = options.getString('color');

const embed = {
title: title,
description: description,
color: color ? color.replace('#', '') : 'RANDOM' // If color is not provided, use random color
};

await interaction.reply({ embeds: [embed] });
},
};
Error in thread
11 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 2/29/2024 in #djs-questions
url.js gives error
Code:
const { SlashCommandBuilder } = require('discord.js');
const fetch = require('node-fetch');

const data = new SlashCommandBuilder()
.setName('url')
.setDescription('Add an emoji from a PNG URL')
.addStringOption(option =>
option.setName('url')
.setDescription('The URL of the emoji image (PNG)')
.setRequired(true))
.addStringOption(option =>
option.setName('name')
.setDescription('The name you want to give to the emoji')
.setRequired(true));

async function execute(interaction) {
const emojiURL = interaction.options.getString('url');
const emojiName = interaction.options.getString('name');

try {
const response = await fetch(emojiURL);
if (!response.ok) {
return await interaction.reply('Failed to fetch the image. Make sure the URL is valid and accessible.');
}
const emojiData = await response.buffer();

// Check if the file is a PNG
if (!emojiURL.endsWith('.png')) {
return await interaction.reply('The provided URL is not a PNG image.');
}

// Add emoji to the guild
await interaction.guild.emojis.create(emojiData, emojiName)
.then(emoji => interaction.reply(`Emoji ${emoji.name} added successfully!`))
.catch(error => {
console.error('Error adding emoji:', error);
interaction.reply('Failed to add the emoji. Make sure the URL is valid and accessible, and you have the necessary permissions to add emojis.');
});
} catch (error) {
console.error('Error adding emoji:', error);
await interaction.reply('Failed to add the emoji. Make sure the URL is valid and accessible.');
}
}

module.exports = {
data: data,
execute: execute
};
const { SlashCommandBuilder } = require('discord.js');
const fetch = require('node-fetch');

const data = new SlashCommandBuilder()
.setName('url')
.setDescription('Add an emoji from a PNG URL')
.addStringOption(option =>
option.setName('url')
.setDescription('The URL of the emoji image (PNG)')
.setRequired(true))
.addStringOption(option =>
option.setName('name')
.setDescription('The name you want to give to the emoji')
.setRequired(true));

async function execute(interaction) {
const emojiURL = interaction.options.getString('url');
const emojiName = interaction.options.getString('name');

try {
const response = await fetch(emojiURL);
if (!response.ok) {
return await interaction.reply('Failed to fetch the image. Make sure the URL is valid and accessible.');
}
const emojiData = await response.buffer();

// Check if the file is a PNG
if (!emojiURL.endsWith('.png')) {
return await interaction.reply('The provided URL is not a PNG image.');
}

// Add emoji to the guild
await interaction.guild.emojis.create(emojiData, emojiName)
.then(emoji => interaction.reply(`Emoji ${emoji.name} added successfully!`))
.catch(error => {
console.error('Error adding emoji:', error);
interaction.reply('Failed to add the emoji. Make sure the URL is valid and accessible, and you have the necessary permissions to add emojis.');
});
} catch (error) {
console.error('Error adding emoji:', error);
await interaction.reply('Failed to add the emoji. Make sure the URL is valid and accessible.');
}
}

module.exports = {
data: data,
execute: execute
};
7 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 2/29/2024 in #djs-questions
/reload error
/reload gives an error when i try to reload a command Error while executing this command (inside discord ) Code:
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
category: 'utility',
data: new SlashCommandBuilder()
.setName('reload')
.setDescription('Reloads a command.')
.addStringOption(option =>
option.setName('command')
.setDescription('The command to reload.')
.setRequired(true)),
async execute(interaction) {
const commandName = interaction.options.getString('command', true).toLowerCase();
const command = interaction.client.commands.get(commandName);

if (!command) {
return interaction.reply(`There is no command with name \`${commandName}\`!`);
}

delete require.cache[require.resolve(`../${command.category}/${command.data.name}.js`)];

try {
interaction.client.commands.delete(command.data.name);
const newCommand = require(`../${command.category}/${command.data.name}.js`);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply(`Command \`${newCommand.data.name}\` was reloaded!`);
} catch (error) {
console.error(error);
await interaction.reply(`There was an error while reloading a command \`${command.data.name}\`:\n\`${error.message}\``);
}
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
category: 'utility',
data: new SlashCommandBuilder()
.setName('reload')
.setDescription('Reloads a command.')
.addStringOption(option =>
option.setName('command')
.setDescription('The command to reload.')
.setRequired(true)),
async execute(interaction) {
const commandName = interaction.options.getString('command', true).toLowerCase();
const command = interaction.client.commands.get(commandName);

if (!command) {
return interaction.reply(`There is no command with name \`${commandName}\`!`);
}

delete require.cache[require.resolve(`../${command.category}/${command.data.name}.js`)];

try {
interaction.client.commands.delete(command.data.name);
const newCommand = require(`../${command.category}/${command.data.name}.js`);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply(`Command \`${newCommand.data.name}\` was reloaded!`);
} catch (error) {
console.error(error);
await interaction.reply(`There was an error while reloading a command \`${command.data.name}\`:\n\`${error.message}\``);
}
},
};
10 replies
DIdiscord.js - Imagine ❄
Created by </JustTheDev> on 2/29/2024 in #djs-questions
Bot status & guild count
How do i set the bot status to something like WATCHING {guilds-the-bot-is-in} servers
8 replies