import config from './config.json'; import { CommandoClient } from 'discord.js-commando'; //import WS from './ws/ws'; import Welcome from './models/welcome.js'; import mongo from 'mongoose'; mongo.connect('mongodb://sin:cSDZEygGZz232eJ5bS@ds047107.mlab.com:47107/heroku_4qrjvmb9') import path from 'path'; import emoji from 'emoji-random'; require('./models/MusicGuild.js') const client = new CommandoClient({ commandPrefix: 'uwu!', owner: '217348698294714370', invite: 'https://discord.gg/DVwXUwx', }); //var ws = new WS('123456', process.env.PORT, client) client.registry .registerDefaultTypes() .registerGroups([ ['fun', 'Fun Command Group'], ['moderation', 'Moderation Command Group'], ['server', 'Server Command Group'], ['voice', 'Voice Command Group'], ['nsfw', 'NSFW Command Group'], ['anime', 'Anime Command Group'], ['crypto', 'Crypto Command Group'], ['zerotwo', 'Zero Two Command Group'], ['bot', 'Bot COmmand Group'], ['user', 'User Command Group'] ]) .registerDefaultGroups() .registerDefaultCommands({ help: true }) .registerCommandsIn(path.join(__dirname, 'commands')); client.once('ready', () => { //console.log(`Started bot: ${client.user.tag} (ID: ${client.user.id})\nCurrently running on ${client.guilds.cache.size} server(s).`); console.log('Bot online!') console.log('\x1b[31m' + ` _ _ __ _ | | | | / _(_) | | | |_ ___ _| |_ _ ___ _ __ | | | \\ \\ /\\ / / | | | _| |/ _ \\ '__| | |_| |\\ V V /| |_| | | | | __/ | \\___/ \\_/\\_/ \\__,_|_| |_|\\___|_| `) console.log('\x1b[0m' + 'discord.js Version: ' + '\x1b[36m' + '2.11') console.log('\x1b[0m' + 'Node.js Version: ' + '\x1b[36m' + process.version) console.log('\x1b[0m' + 'OS Version: ' + '\x1b[36m' + process.platform) console.log('\x1b[0m' + 'Name: ' + '\x1b[36m' + `${client.user?.tag}`) console.log('\x1b[0m' + 'ID: ' + '\x1b[36m' + `${client.user?.id}`) console.log('\x1b[0m' + 'Servers: ' + '\x1b[36m' + `${client.guilds.cache.size}` + '\x1b[0m') console.log() client.user.setActivity('uwu!help | v' + config['version'], { type: 'WATCHING' }); }); client.on('error', console.error); //client.on('debug', console.debug); client.on('guildCreate', guild => { console.log(`Joined server: ${guild.name}`) guild.owner?.send('Hi! Thank you for inviting my bot to your server! To view the complete list of commands, do `uwu!help`. If you\'d like, you can also change the prefix using `uwu!prefix change `. If you want to contact the lead developer for possible suggestions or to report a bug please join the support server: https://discord.gg/DVwXUwx. ' + emoji.random()) }) client.on('guildMemberAdd', member => { Welcome.findOne({ guildID: member.guild.id }, async (error, guild) => { if (error) { console.log(error) } else if (!guild) { return } else if (guild) { member.guild.channels.cache.get(guild.channelID).send(`<@${member.id}> has joined **${member.guild.name}**! ` + emoji.random()) } else { return } }) }) client.on('message', async msg => { var msgContent = msg.content.toLowerCase(); function prefixCheck() { if (msgContent.startsWith('uwu!')) { return true; } } if (prefixCheck()) { if (msg.channel.type == 'dm') { console.log(msg.author.tag, 'says', msgContent, 'in a DM'); } else { console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name + ' in ' + msg.guild.name); } } if (msg.mentions.everyone) { msg.react(emoji.random()); } }); client.login(config['secret']);