Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.01 KB | None | 0 0
  1. const botconfig = JSON.parse(fs.readFileSync('./botconfig.json', 'utf8'));
  2. let gamesTime = 15000;
  3.  
  4. client.login(botconfig.token);
  5. const dailies = require("./dailies.json")
  6. const sqlite3 = require("sqlite3");
  7. const sql = new sqlite3.Database("./edited.sqlite");
  8.  
  9. client.on('message', message => {
  10. if (message.channel.type == "dm") return console.log(message.author.username + ` => type this (${message.content}) in Dm`);
  11. if (message.author.bot) return;
  12.  
  13.  
  14. // T E X T - S Y S T E M //
  15. client.on('message', message => {
  16. if (message.channel.type == "dm") return console.log(message.author.username + ` => type this (${message.content}) in Dm`);
  17. if (message.author.bot || message.system) return;
  18. /* T E X T - S Y S T E M */
  19. if (message.content.startsWith(prefix + "daily") || message.content.startsWith(prefix + "هدية")) {
  20. let cooldown = 8.64e+7;
  21. let lastDaily = dailies[message.author.id]
  22. if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) {
  23. let timeObj = (cooldown - (Date.now() - lastDaily));
  24. message.channel.send(`**:stopwatch: | ${message.author.username}, هناك مدة زمنية محددة للحصول علي هدية جديدة : \`${pretty(timeObj, {verbose:true})}\`**`)
  25. } else {
  26. const amount = 500;
  27. dailies[message.author.id] = Date.now();
  28. sql.run(`UPDATE scores SET credit = ${row.credit + amount} WHERE userId = ${message.author.id}`);
  29. message.channel.send(`**:atm: | ${message.author.username}, لقد أستلمت : \`${amount}\` كـهدية يومية **`)
  30. fs.writeFile("./dailies.json", JSON.stringify(dailies, null, 2), (err) => {
  31. if (err) console.log(err);
  32. });
  33. };
  34. };
  35. if (message.content.startsWith(prefix + "credits") || message.content.startsWith(prefix + "credit")) {
  36. let row = getUserData(message.author.id);
  37. if (message.mentions.users.size < 1) {
  38. return message.channel.send(`**:credit_card: | ${message.author.username}, لديك : ` + "``$" + `${row.credit} ` + "``" + ` من الكريديت **`).catch(error => message.channel.send(`**:white_check_mark: | تم تفعيل حسابك البنكي **`));
  39. } else {
  40. let transferto = message.mentions.users.first();
  41. if (transferto.bot) return message.channel.send(`**:robot: | ${message.author.username}, البوتات لا تمتلك ليفيل وكريديت . :wink:**`);
  42. if (transferto.id === message.author.id) return message.channel.send(`من جدك ؟`);
  43. let transfer = message.content.split(" ").slice(2).join("");
  44. if (row.credit < transfer) return message.channel.send(`**:thinking: | ${message.author.username}, ليس لديك المال الكافي لذلك**`)
  45. //getting data from database for the target
  46. let transfertoRow = getUserData(transferto.id);
  47. if (!transfer) return message.channel.send(`**:credit_card: | ${transferto.username}, لديك : ` + "``$" + `${transfertoRow.credit} ` + "``" + ` من الكريديت**`);
  48. if (isNaN(transfer) || transfer < 1) return message.channel.send("**:x: | يرجي أدخال رقم صحيح **");
  49. //awaiting for the confirm message
  50. function codeGen() {
  51. return Math.floor(Math.random() * (9 - 0 + 1) + 0);
  52. }
  53. let code = `${codeGen()}${codeGen()}${codeGen()}${codeGen()}`;
  54. message.channel.send(`➡ | لتحويل مبلغ : ${transfer}
  55. الى : ${transferto}
  56. يرجاء كتابة الرقم التالي: \`\`\`${code}\`\`\``).then(codeMessage => {
  57. message.channel.awaitMessages(m => m.author.id === message.author.id, {
  58. time: 20000,
  59. max: 1,
  60. errors: ["time"]
  61. }).then(messages => {
  62. let msg = messages.first();
  63. codeMessage.delete();
  64. if (msg.content !== code) return message.channel.send(`خطأ`);
  65. //transfering the money
  66. sql.run(`UPDATE scores SET credit = credits - ${parseInt(transfer)} WHERE userId = ${message.author.id}`);
  67. sql.run(`UPDATE scores SET credit = credits + ${parseInt(transfer)} WHERE userId = ${transferto.id}`);
  68. //sending messages
  69. message.channel.send(` **➡ | تمت عملية التحويل
  70. 🕊 | ${transferto} : ${message.author.username}, لقد قمت بأرسال ` + "$`" + transfer + "`" + ` لـ ** `)
  71. transferto.send(`**:atm: | تمت عملية التحويل** \`\`\`\n لقد حولت : ${transfer} لـ ${message.author.username} . (ID: ${message.author.id})\`\`\``)
  72. client.channels.get("550305753488031764").send(`ايدي المرسل : \`${transferto.id}\`
  73. اسم المستقبل : \`${transferto.username}\`
  74. ايدي المستقبل : \`${message.author.id}\`
  75. اسم المرسل : \`${message.author.username}\`
  76. المبلغ : \`${transfer}\`
  77. `);
  78. })
  79. });
  80. };
  81. };
  82. });
  83. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement