diff options
Diffstat (limited to 'src/bot.ts')
| -rw-r--r-- | src/bot.ts | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -1,13 +1,17 @@ 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:[email protected]:47107/heroku_4qrjvmb9') import path from 'path'; import emoji from 'emoji-random'; require('./models/MusicGuild.js') const client = new CommandoClient({ commandPrefix: 'uwu!', - owner: '217348698294714370' + owner: '217348698294714370', + invite: 'https://discord.gg/DVwXUwx', }); //var ws = new WS('123456', process.env.PORT, client) @@ -61,6 +65,21 @@ client.on('error', console.error); 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 <prefix>`. 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 => { |