Files
commands
database
events
handlers
systems
utils
config.json
index.js
package.json
Code
86 4,777
index.js
const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js');
const mongoose = require('mongoose');
const chalk = require('chalk');
const config = require('./config.json');
const { loadCommands } = require('./handlers/commandHandler');
const { loadEvents } = require('./handlers/eventHandler');
const logger = require('./systems/loggingSystem');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildIntegrations,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessageTyping,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildScheduledEvents,
GatewayIntentBits.AutoModerationConfiguration,
GatewayIntentBits.AutoModerationExecution,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
allowedMentions: {
parse: ['users', 'roles'],
repliedUser: false,
},
});
client.commands = new Collection();
client.prefixCommands = new Collection();
client.aliases = new Collection();
client.cooldowns = new Collection();
client.giveaways = new Collection();
client.afkUsers = new Collection();
client.antiSpam = new Collection();
client.antiRaid = new Collection();
client.config = config;
const { DisTube } = require('distube');
const { SpotifyPlugin } = require('@distube/spotify');
const { SoundCloudPlugin } = require('@distube/soundcloud');
const { YtDlpPlugin } = require('@distube/yt-dlp');
client.distube = new DisTube(client, {
plugins: [
new SpotifyPlugin(),
new SoundCloudPlugin(),
new YtDlpPlugin(),
],
emitNewSongOnly: false,
joinNewVoiceChannel: true,
nsfw: false,
emitAddListWhenCreatingQueue: true,
});
async function init() {
console.log(chalk.red('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ'));
console.log(chalk.red.bold(' โ๏ธ MINEHOOD BOT - STARTING UP โ๏ธ '));
console.log(chalk.red('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ'));
try {
await mongoose.connect(config.mongoURI);
console.log(chalk.green('โ
Database Connected'));
logger.info('MongoDB connected successfully');
} catch (err) {
console.error(chalk.red('โ Database Connection Failed:', err.message));
logger.error('MongoDB connection failed: ' + err.message);
process.exit(1);
}
const commandCount = await loadCommands(client);
console.log(chalk.cyan(`โ
Commands Loaded: ${commandCount}`));
const eventCount = await loadEvents(client);
console.log(chalk.cyan(`โ
Events Loaded: ${eventCount}`));
require('./systems/giveawaySystem')(client);
require('./systems/inviteTracker')(client);
require('./systems/messageTracker')(client);
await client.login(config.token);
}
process.on('unhandledRejection', (reason, promise) => {
logger.error(`Unhandled Rejection at: ${promise} reason: ${reason}`);
console.error(chalk.red('Unhandled Rejection:'), reason);
});
process.on('uncaughtException', (err) => {
logger.error(`Uncaught Exception: ${err.message}`);
console.error(chalk.red('Uncaught Exception:'), err);
});
process.on('uncaughtExceptionMonitor', (err) => {
logger.error(`Uncaught Exception Monitor: ${err.message}`);
});
init();
module.exports = client;