Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('message', message => {
- if (!message.content.startsWith(prefix) || message.author.bot) return;
- const args = message.content.slice(prefix.length).trim().split(/ +/);
- const command = args.shift().toLowerCase();
- if(command === "set-welcomech") {
- if(!message.member.hasPermission('MANAGE_GUILD')) return;
- let welcomechdb = message.guild.channels.cache.find(ch => ch.id === args[0])
- if(welcomechdb) {
- message.channel.send(`welcome channel set to ${welcomechdb}`)
- db.set(`on_${message.guild.id}`, args[0])
- }}
- if(command === "set-welcomemsg") {
- if(!message.member.hasPermission('MANAGE_GUILD')) return;
- message.channel.send(`new welcome message is : \n ${args.join(" ")}`)
- db.set(`on2`, args.join(" "))
- }
- });
- client.on('guildMemberAdd', member => {
- let welcomech = db.fetch(`on_${member.guild.id}`)
- let message = db.fetch(`on2`)
- if(db.has(`on_${member.guild.id}`)) {
- member.guild.channels.cache.find(ch => ch.id === welcomech).send(`${member} ${message}`).then(msg => {
- msg.delete({timeout:5000})
- })
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement