Advertisement
gaber-elsayed

auto reply st.db

Oct 29th, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. const Database = require('st.db')
  2. const data = new Database({
  3. path:'data.json',
  4. crypto: {
  5. encrypt:false,
  6. }
  7. })
  8. client.on("message", message => {
  9. if(message.content.startsWith(prefix + "add-reply")){
  10. message.channel.send("اكتب الكلمه" )
  11. var filter = m => m.author.id == message.author.id;
  12. message.channel.awaitMessages(filter, {
  13. max: 1,
  14. time: 30000,
  15. errors: ['time'],
  16. }).then((collected) => {
  17. let word = collected.first().content
  18. message.channel.send("الرد")
  19. var filter = m => m.author.id == message.author.id;
  20. message.channel.awaitMessages(filter, {
  21. max: 1,
  22. time: 30000,
  23. errors: ['time'],
  24. }).then((collected) => {
  25. let reply = collected.first().content
  26. data.set({
  27. key : `reply_${message.guild.id}_${word.toLowerCase()}`,
  28. value : reply
  29. })
  30. message.channel.send("Done Set Word = " + word + " /And Reply = "+ reply)
  31. })
  32. })
  33. }
  34. })
  35. client.on("message", message => {
  36. if(data.has({key:`reply_${message.guild.id}_${message.content.toLowerCase()}`}) == true){
  37. message.channel.send(data.get({key:`reply_${message.guild.id}_${message.content.toLowerCase()}`}))
  38. }else return; 
  39.  
  40. })
  41.  
  42. client.on("message", message => {
  43. if(message.content.startsWith(prefix + "delete-reply")){
  44. var args = message.content.split(" ").slice(1).join(" ")
  45. if(!args)return message.channel.send("الكلمه ال عايز تحذفها ")
  46. if(data.has({key:`reply_${message.guild.id}_${args.toLowerCase()}`}) == true){
  47. data.delete({key :`reply_${message.guild.id}_${args.toLowerCase()}` })
  48. message.channel.send("Done Delete Word")
  49. }else message.channel.send("I Can't Find This Word")
  50. }
  51. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement