Would i be able to get help from some people updating my older code to a newer version?

Title explains itself. I have some code that I have form an old bot I made before and now, I'm looking to revive said bot but I'm very out of practice and am requiring assistance if thats ok with anyone. The code is on Replit so it's easy to access. Please let me know if you could help me update the code, and that'd be great. Thanks!
4 Replies
d.js toolkit
d.js toolkit13mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
vira
vira13mo ago
d.js version: discord.js@14.11.0 (code isn't updated to standard) v18.12.1 This is just the index.js code:
const Discord = require('discord.js');
const fs = require('fs');
const client = new Discord.Client({
intents: [
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
Discord.Intents.FLAGS.GUILD_MEMBERS,
Discord.Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Discord.Intents.FLAGS.GUILD_VOICE_STATES,
]
});
client.commands = new Discord.Collection();

const prefix = '/';

let hostRole = null;

let emRole = null;

let blacklistChannel = null;

const points = {};

const {
BOT_TOKEN,
} = process.env;

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
console.log(`${command.name} command loaded successfully.`);
}

client.once('ready', () => {
console.log('Bot is ready!');
});

client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();

if (!client.commands.has(command)) return;

try {
const cmd = client.commands.get(command);
cmd.execute(message, args, { hostRole, emRole, blacklistChannel, points });
} catch (error) {
console.error(error);
message.reply('There was an error executing the command.');
}
});

client.login(BOT_TOKEN);
const Discord = require('discord.js');
const fs = require('fs');
const client = new Discord.Client({
intents: [
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
Discord.Intents.FLAGS.GUILD_MEMBERS,
Discord.Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Discord.Intents.FLAGS.GUILD_VOICE_STATES,
]
});
client.commands = new Discord.Collection();

const prefix = '/';

let hostRole = null;

let emRole = null;

let blacklistChannel = null;

const points = {};

const {
BOT_TOKEN,
} = process.env;

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
console.log(`${command.name} command loaded successfully.`);
}

client.once('ready', () => {
console.log('Bot is ready!');
});

client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();

if (!client.commands.has(command)) return;

try {
const cmd = client.commands.get(command);
cmd.execute(message, args, { hostRole, emRole, blacklistChannel, points });
} catch (error) {
console.error(error);
message.reply('There was an error executing the command.');
}
});

client.login(BOT_TOKEN);
duck
duck13mo ago
in case you missed it in #general, here's the v14 upgrade guide https://discordjs.guide/additional-info/changes-in-v14.html#updating-from-v13-to-v14 this isn't really the place to request someone to completely rewrite it for you if you have more specific questions, like parts of the guide that you need help understanding or parts of your code that you didn't feel the guide covered, feel free to ask them
vira
vira13mo ago
Thank you very much for the advice but I am not asking for someone to fully rewrite it for me. I'm looking for someone to re-write it with me. Nevertheless, I'll go through the docs, and work on it.