Advertisement
3MoSteve

Move Bot Owner Code

Dec 4th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. //by 3Mo_Steve | Toxic Codes
  2. const {
  3. readFileSync,
  4. writeFileSync
  5. } = require("fs");
  6. const BotInfo = JSON.parse(readFileSync("./bot_info.json", "utf-8"));
  7. const saveBot = () => writeFileSync("./bot_info.json", JSON.stringify(BotInfo, null, 2));
  8.  
  9. const Developer = "ايدي تبعك منشان يكون معك التحكم باوامر الاونر و تغير الاونر";
  10. client.on("ready", () => { //لاتحذف الكود او بيخرب !
  11. if (!BotInfo[client.user.id]) {
  12. BotInfo[client.user.id] = {
  13. owner: null
  14. }
  15. saveBot();
  16. }
  17. client.owner = BotInfo[client.user.id].owner;
  18. });
  19.  
  20. function setOwner (id) {
  21. BotInfo[client.user.id] = {
  22. owner: id
  23. }
  24. saveBot();
  25. }
  26. function isOwner (id) {
  27. return [BotInfo[client.user.id].owner, Developer].includes (id);
  28. }
  29. client.on("message", message => {
  30. if (!message.guild || message.author.bot) return; //هون ازا الرسالة بلخاص حق البوت او الرسالة انرسلت من بوت ثاني مايستقبلها البوت تبعك
  31. if (message.content.startsWith("$move")) { //$move ازا الرسالة بتبلش ف
  32. if (isOwner(message.author.id)) { //هون ييشيك لو الرسالة من اونر القديم او الاونر الحالي
  33. const newOwner = message.mentions.users.first();
  34. if (!newOwner) return message.channel.send(`$move <mention>`); //لو ما منشن الاونر الجديد يرسله رسالة
  35. if (newOwner.id == client.owner) return message.channel.send(`._.`); //لو حاول يرسل الاونر لنفسه يعني لو حاول يستهبل
  36. setOwner (newOwner.id);
  37. message.channel.send (`**Successfully moved the Owner from ${message.author} to ${newOwner}**`);
  38. }
  39. }
  40. });
  41. /*
  42. تعليمات للتحويل وتأكيد الاونر
  43. ازا بدك تتأكد انو الرسالة من الاونر تبع البوت اكتب
  44. if (isOwner (ايدي الشخص)) {
  45. كود الي يشتغل في حال كان الاونر
  46. }
  47. كمثال
  48. if (isOwner (message.author.id)) {
  49. message.channel.send ('You are the owner.');
  50. }
  51.  
  52. لسحب الاونر شيب لشخص ثاني
  53.  
  54. setOwner (ايدي الاونر الجديد);
  55. كمثال
  56. setOwner (newOwner.id);
  57. او
  58. setOwner ("ID")
  59. */
  60.  
  61. //By 3Mo_Steve
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement