Advertisement
gaber-elsayed

simple welcom

Oct 6th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. client.on('message', message => {
  2. if (!message.content.startsWith(prefix) || message.author.bot) return;
  3.  
  4. const args = message.content.slice(prefix.length).trim().split(/ +/);
  5. const command = args.shift().toLowerCase();
  6. if(command === "set-welcomech") {
  7. if(!message.member.hasPermission('MANAGE_GUILD')) return;
  8. let welcomechdb = message.guild.channels.cache.find(ch => ch.id === args[0])
  9. if(welcomechdb) {
  10. message.channel.send(`welcome channel set to ${welcomechdb}`)
  11. db.set(`on_${message.guild.id}`, args[0])
  12. }}
  13. if(command === "set-welcomemsg") {
  14. if(!message.member.hasPermission('MANAGE_GUILD')) return;
  15. message.channel.send(`new welcome message is : \n ${args.join(" ")}`)
  16. db.set(`on2`, args.join(" "))
  17. }
  18. });
  19. client.on('guildMemberAdd', member => {
  20. let welcomech = db.fetch(`on_${member.guild.id}`)
  21. let message = db.fetch(`on2`)
  22. if(db.has(`on_${member.guild.id}`)) {
  23. member.guild.channels.cache.find(ch => ch.id === welcomech).send(`${member} ${message}`).then(msg => {
  24. msg.delete({timeout:5000})
  25. })
  26. }
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement