vira
vira
DIAdiscord.js - Imagine an app
Created by vira on 6/20/2023 in #djs-questions
Would i be able to get help from some people updating my older code to a newer version?
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.
7 replies
DIAdiscord.js - Imagine an app
Created by vira on 6/20/2023 in #djs-questions
Would i be able to get help from some people updating my older code to a newer version?
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);
7 replies
DIAdiscord.js - Imagine an app
Created by vira on 6/20/2023 in #djs-questions
Would i be able to get help from some people updating my older code to a newer version?
d.js version: [email protected] (code isn't updated to standard) v18.12.1
7 replies