Advertisement
gaber-elsayed

رد تلقائي

Oct 6th, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. client.on('message', message => {
  2. const args = message.content.slice(prefix.length).trim().split(/ +/);
  3. const command = args.shift().toLowerCase();
  4. if(message.channel.type === 'dm') return;
  5. let f = m1 => m1.author.id === message.author.id
  6. if(command === 'add') {
  7. if(!message.member.hasPermission('MANAGE_MESSAGES')) return;
  8. message.channel.send('what the word you want to add?.').then(m => {
  9.  
  10. m.channel.awaitMessages(f, {max:1, time: 20000, errors:['time']}).then(m1 => {
  11. m1 = m1.first()
  12. let b = m1.content
  13. message.channel.send('what reply you want to be for this word?').then(m2 => {
  14. m2.channel.awaitMessages(f,{max:1, time: 20000, errors:['time']}).then(m3 => {
  15. m3 = m3.first()
  16. let rep = m3.content
  17. message.channel.send('added reply!!')
  18. db.set(`${b}_${message.guild.id}`, `${rep}`)
  19. }).catch(err => {message.channel.send('time is over!')})
  20. })
  21.  
  22. }).catch(err => {message.channel.send('time is over!')})
  23. })
  24. }
  25. if(command === 'remove') {
  26. if(!message.member.hasPermission('MANAGE_MESSAGES')) return;
  27. message.channel.send("which word you want to remove?").then(r => {
  28. r.channel.awaitMessages(f,{max:1, time: 20000, errors:['time']}).then(f => {
  29. f = f.first()
  30. let ff = f.content
  31. if(!db.has(`${ff}_${message.guild.id}`)) return message.channel.send('no word was found with this tag!')
  32. message.channel.send('removed!!')
  33. db.delete(`${ff}_${message.guild.id}`)
  34. }).catch(err => {message.channel.send('time is over!')})
  35. })
  36. }
  37. })
  38.  
  39. client.on('message', message =>{
  40. if(message.channel.type === 'dm') return;
  41. if(db.has(`${message.content}_${message.guild.id}`)) {
  42. message.channel.send(db.get(`${message.content}_${message.guild.id}`))
  43. }
  44. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement