Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2019
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.59 KB | None | 0 0
  1. const Discord = require("discord.js");
  2. const fs = require("fs");
  3. const bot = new Discord.Client();
  4. const pretty = require("pretty-ms");
  5. const moment = require("moment");
  6. const botconfig = JSON.parse(fs.readFileSync('./jsonfile/botconfig.json','utf8'));
  7. const prefix = "$"
  8. let gamesTime = 15000;
  9.  
  10. bot.login(botconfig.token);
  11. const dailies = require("./dailies.json")
  12. const con = require("mysql").createConnection({
  13. host: "localhost",
  14. pass: "passss",
  15. username: "root",
  16. database: "db"
  17. });
  18. const done = {};
  19. let done1 = {};
  20. let done2 = {};
  21. bot.on('ready', () =>{
  22. console.log(`On Know`)
  23. })
  24. bot.on('message' , message => {
  25. if(message.channel.type == "dm") return console.log(message.author.username+` => type this (${message.content}) in Dm`);
  26. if(message.author.bot) return;
  27.  
  28.  
  29. // T E X T - S Y S T E M //
  30. con.query(`SELECT * FROM scores WHERE userId ="${message.author.id}"`).then(row => {
  31. con.query(`SELECT * FROM scores WHERE userId ="${message.author.id}" AND guildId ="${message.guild.id}"`).then(rowguild => {
  32. if(!row || !rowguild) {
  33. con.query(`INSERT INTO scores (
  34. userId, winNu ,
  35. loseNu,gamesNu,
  36. pointsFkk,points3oasm,
  37. pointslogo,pointsimoje,
  38. pointssr3h,pointsa3lam,
  39. xp , credit,
  40. level , like,
  41. ane , background,
  42. vcpoints, vclevel,
  43. guildId, xpguild
  44. ) VALUES ("${message.author.id}", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,'$set-info' ,'default', 1, 0, "${message.guild.id}", 0)`)
  45. } else {
  46.  
  47. }
  48. }).catch((e) => {
  49. console.log(e);
  50. con.query(`CREATE TABLE IF NOT EXISTS scores
  51. (userId TEXT,
  52. winNu INTEGER,
  53. loseNu INTEGER,
  54. gamesNu INTEGER,
  55. pointsFkk INTEGER,
  56. points3oasm INTEGER,
  57. pointslogo INTEGER,
  58. pointsimoje INTEGER ,
  59. pointssr3h INTEGER,
  60. pointsa3lam INTEGER,
  61. xp INTEGER,
  62. credit INTEGER,
  63. level INTEGER,
  64. like INTEGER,
  65. ane TEXT,
  66. background TEXT,
  67. vcpoints INTEGER,
  68. vclevel INTEGER,
  69. guildId TEXT,
  70. xpguild INTEGER
  71. )`).then(() => {
  72. con.query(`INSERT INTO scores (
  73. userId, winNu ,
  74. loseNu,gamesNu,
  75. pointsFkk,points3oasm,
  76. pointslogo,pointsimoje,
  77. pointssr3h,pointsa3lam,
  78. xp , credit,
  79. level , like,
  80. ane , background,
  81. vcpoints, vclevel,
  82. guildId, xpguild
  83. ) VALUES ("${message.author.id}", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,'$set-info' ,'default', 1, 0, "${message.guild.id}", 0)`)
  84. });
  85. });
  86. }).catch((e) => {
  87. console.log(e);
  88. con.query(`CREATE TABLE IF NOT EXISTS scores
  89. (userId TEXT,
  90. winNu INTEGER,
  91. loseNu INTEGER,
  92. gamesNu INTEGER,
  93. pointsFkk INTEGER,
  94. points3oasm INTEGER,
  95. pointslogo INTEGER,
  96. pointsimoje INTEGER ,
  97. pointssr3h INTEGER,
  98. pointsa3lam INTEGER,
  99. xp INTEGER,
  100. credit INTEGER,
  101. level INTEGER,
  102. like INTEGER,
  103. ane TEXT,
  104. background TEXT,
  105. vcpoints INTEGER,
  106. vclevel INTEGER,
  107. guildId TEXT,
  108. xpguild INTEGER
  109. )`).then(() => {
  110. con.query(`INSERT INTO scores (
  111. userId, winNu ,
  112. loseNu,gamesNu,
  113. pointsFkk,points3oasm,
  114. pointslogo,pointsimoje,
  115. pointssr3h,pointsa3lam,
  116. xp , credit,
  117. level , like,
  118. ane , background,
  119. vcpoints, vclevel,
  120. guildId, xpguild
  121. ) VALUES ("${message.author.id}", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,'$set-info' ,'default', 1, 0, "${message.guild.id}", 0)`)
  122. });
  123. });
  124. //////////////////////////// C O M M A N D S /////////////////////////////////////////////////////////////
  125. con.query(`SELECT * FROM scores WHERE userId ="${message.author.id}"`).then(row => {
  126. con.query `SELECT * FROM scores WHERE userId ="${message.author.id}" AND guildId ="${message.guild.id}"`).then(rowguild => {
  127. if(message.channel.type == "dm") return;
  128. if(message.author.bot) return;
  129.  
  130.  
  131.  
  132.  
  133. if(message.content.startsWith(prefix + "daily") || message.content.startsWith(prefix + "هدية") ) {
  134. let cooldown = 8.64e+7
  135. let lastDaily = dailies[message.author.id]
  136. if(lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0){
  137. let timeObj = (cooldown - (Date.now() - lastDaily));
  138. message.channel.send(`**:stopwatch: | ${message.author.username}, هناك مدة زمنية محددة للحصول علي هدية جديدة : \`${pretty(timeObj, {verbose:true})}\`**`)
  139. }
  140. else {
  141. const amount = 500
  142. dailies[message.author.id] = Date.now();
  143. con.query(`UPDATE scores SET credit = ${row[0].credit + amount} WHERE userId = '${message.author.id}'`);
  144. message.channel.send(`**:atm: | ${message.author.username}, لقد أستلمت : \`${amount}\` كـهدية يومية **`)
  145.  
  146. fs.writeFile("./dailies.json", JSON.stringify(dailies, null, 2), (err) => {
  147. if(err) console.log(err)
  148. });
  149. }
  150. }
  151.  
  152. if(message.content.startsWith(prefix + "credits") || message.content.startsWith(prefix + "credit") ) {
  153. if(message.mentions.users.size < 1) {
  154. if(row) {
  155. return message.channel.send(`**:credit_card: | ${message.author.username}, لديك : ` + "``$"+ `${row.credit} ` + "``" + ` من الكريديت **`).catch(error => message.channel.send(`**:white_check_mark: | تم تفعيل حسابك البنكي **`));
  156. } else {return message.channel.send(`**:credit_card: | ${message.author.username}, لديك : ` + "``$"+ `0 ` + "``" + ` من الكريديت**`)}
  157. } else {
  158. let transferto = message.mentions.users.first();
  159. if(transferto.bot) return message.channel.send(`**:robot: | ${message.author.username}, البوتات لا تمتلك ليفيل وكريديت . :wink:**`);
  160. if(transferto.id === message.author.id) return message.channel.send(`من جدك ؟`);
  161. if(transferto) { if(!row) {return message.channel.send(`**:x: | ${transferto.username}, لا يوجد حساب كريديت بنكي لهذا الشخص **`)}}
  162. let transfer = message.content.split(" ").slice(2).join("")
  163. if(row[0].credit < transfer) return message.channel.send(`**:thinking: | ${message.author.username}, ليس لديك المال الكافي لذلك**`)
  164. con.query(`SELECT * FROM scores WHERE userId ="${transferto.id}"`).then(row1 => {
  165. if(!transfer) {
  166. if(!row1) {
  167. return message.channel.send(`**:credit_card: | ${transferto.username}, لديك : ` + "``$"+ `0 ` + "``" + ` من الكريديت**`)
  168. }
  169. return message.channel.send(`**:credit_card: | ${transferto.username}, لديك : ` + "``$" + `${row1.credit} ` + "``" + ` من الكريديت**`);
  170. }
  171. if(isNaN(transfer)) {
  172. return message.channel.send("**:x: | يرجي أدخال رقم صحيح **")
  173. }
  174. if(transfer < 1) return message.channel.send(`**:x: | يرجي أدخال رقم صحيح **`)
  175. if(!row1) {
  176. con.query(`UPDATE scores SET credit = ${row[0].credit - parseInt(transfer)} WHERE userId = '${message.author.id}'`);
  177. con.query("CREATE TABLE IF NOT EXISTS scores (userId, credit)").then(() => {
  178. con.query("INSERT INTO scores (userId, credit) VALUES ('${transferto.id}', '${parseInt(transfer)}')");
  179. message.channel.send(` **➡ | تمت عملية التحويل
  180. 🕊 | ${transferto} : ${message.author.username}, لقد قمت بأرسال ` +"$`"+transfer+"`"+` لـ ** `)
  181. bot.users.find("id", `${transferto.id}`).send(`**:atm: | تمت عملية التحويل** \`\`\`\n لقد حولت : ${transfer} لـ ${message.author.username} . (ID: ${message.author.id})\`\`\``)
  182. bot.channels.get("550305753488031764").send(`ايدي المرسل : \`${transferto.id}\`
  183. اسم المستقبل : \`${transferto.username}\`
  184. ايدي المستقبل : \`${message.author.id}\`
  185. اسم المرسل : \`${message.author.username}\`
  186. المبلغ : \`${transfer}\`
  187. `);
  188.  
  189. });
  190. }
  191.  
  192.  
  193. let first = Math.floor(Math.random() * 9);
  194. let second = Math.floor(Math.random() * 9);
  195. let third = Math.floor(Math.random() * 9);
  196. let fourth = Math.floor(Math.random() * 9);
  197. let num = `${first}${second}${third}${fourth}`;
  198.  
  199.  
  200. message.channel.send(`➡ | لتحويل مبلغ : ${transfer}
  201. الى : ${transferto}
  202. يرجاء كتابة الرقم التالي: \`\`\`${num}\`\`\``).then(m => {
  203. message.channel.awaitMessages(r => r.author.id === message.author.id, { max: 1, time: 20000, errors:['time'] }).then(collected => {
  204.  
  205. let c = collected.first();
  206. if(c.content === num) {
  207. m.delete();
  208. c.delete();
  209.  
  210. message.channel.send(` **➡ | تمت عملية التحويل
  211. 🕊 | ${transferto} : ${message.author.username}, لقد قمت بأرسال ` +"$`"+transfer+"`"+` لـ ** `)
  212. bot.users.find("id", `${transferto.id}`).send(`**:atm: | تمت عملية التحويل** \`\`\`\n لقد أستملت : ${transfer} من ${message.author.username} . (ID: ${message.author.id})\`\`\``)
  213. bot.channels.get("550305753488031764").send(`ايدي المرسل : \`${transferto.id}\`
  214. اسم المستقبل : \`${transferto.username}\`
  215. ايدي المستقبل : \`${message.author.id}\`
  216. اسم المرسل : \`${message.author.username}\`
  217. المبلغ : \`${transfer}\`
  218. `);
  219. con.query(`UPDATE scores SET credit = ${row[0].credit - parseInt(transfer)} WHERE userId = '${message.author.id}'`);
  220. con.query(`UPDATE scores SET credit = ${row1[0].credit + parseInt(transfer)} WHERE userId = '${transferto.id}'`);
  221.  
  222. } else {
  223. m.delete();
  224. message.channel.send(`خطأا`);
  225. }
  226. })
  227. })
  228. })
  229. }
  230. }
  231.  
  232.  
  233.  
  234.  
  235.  
  236. if(message.content.startsWith("$هات") ) {
  237. const devs = ['516618898850709504','475396751549792277','515096989369761802', '298732816995319809'];
  238. if (!devs.includes(message.author.id)) return;
  239. let args = message.content.split(/[ ]+/);
  240. if(!args[1]) return message.reply("**يجب ادخال رقم اما سالب او موجب**")
  241. if(isNaN(args[1])) return message.reply("**لايمكن تحويل كلمات او احرف**")
  242. if(!args[1].startsWith("+")) return message.reply("**يجب ادخال رقم موجب**")
  243. con.query(`UPDATE scores SET credit = ${row[0].credit + args[1]} WHERE userId = '${message.author.id}'`);
  244. message.reply("**Done**..")
  245.  
  246. }
  247.  
  248. // !args[1].startsWith("-")
  249. if(message.content.startsWith("$خذ") ) {
  250. const devs = ['516618898850709504','515096989369761802'];;
  251. if (!devs.includes(message.author.id)) return;
  252. let args = message.content.split(/[ ]+/);
  253.  
  254. if(!args[1]) return message.reply("**يجب ادخال رقم سالب**")
  255. if(isNaN(args[1])) return message.reply("**لايمكن تحويل كلمات او احرف**")
  256. if(!args[1].startsWith("-")) return message.reply("**يجب ادخال رقم موجب**")
  257. con.query(`UPDATE scores SET credit = ${row[0].credit + args[1]} WHERE userId = '${message.author.id}'`);
  258. message.reply("**Done**..")
  259.  
  260. }
  261. if(message.content.startsWith("$black-cr") ) {
  262. const devs = ['516618898850709504','475396751549792277','515096989369761802'];
  263. if (!devs.includes(message.author.id)) return;
  264.  
  265. let transferto1 = message.mentions.users.first();
  266.  
  267. let transfer1 = message.content.split(" ").slice(2).join("")
  268. con.query(`UPDATE scores SET credit = ${row[0].credit - transfer1} WHERE userId = '${transferto1.id}'`);
  269. message.reply("**Done**..")
  270.  
  271. }
  272.  
  273. con.query(`SELECT * FROM scores WHERE userId ="${message.author.id}"`).then(row => {
  274. if(message.content.startsWith(prefix+"em") || message.content.startsWith(prefix+"ايموجي") ) {
  275. message.channel.stopTyping(false);
  276. const e = JSON.parse(fs.readFileSync('./jsonfile/emoji.json', 'utf8'));
  277. const w = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","aa","bb","cc","dd","ee","ff","gg","hh","ii","jj","kk","ll","mm","nn","oo","pp","qq","rr","ss","tt","uu","vv","ww","xx","yy","zz"]
  278. var c = `${w[Math.floor(Math.random() * w.length)]}`
  279.  
  280. //----
  281. const embed = new Discord.RichEmbed()
  282. .setColor('0bbaba')
  283. .setTitle(`** ابحث عن الايموجي القادم ! :mag_right: **`)
  284. .setThumbnail(e[c].ques)
  285. .setFooter(`امامك 15 ثانية فقط !`)
  286.  
  287. message.channel.sendEmbed(embed).then((mm12) => {setTimeout(()=>{ mm12.edit(new Discord.RichEmbed()
  288. .setColor('0bbaba')
  289. .setTitle(`** هل تذكره ؟؟ **`)
  290. .setThumbnail("https://cdn.discordapp.com/attachments/384692091256700928/447522745304219658/iReHvIZ.png")
  291. .setFooter(`امامك 15 ثانية فقط !`))
  292. },2555)
  293. })
  294. message.channel.stopTyping(true);
  295.  
  296. var mm1=setTimeout(() =>{
  297. const embed = new Discord.RichEmbed()
  298. .setColor(0xff0000)
  299. .setDescription(" :stopwatch: | ` انتهى الوقت `")
  300. message.channel.sendEmbed(embed);
  301.  
  302. },gamesTime);
  303.  
  304. const collector = new Discord.MessageCollector(message.channel, m => m.author.id == message.author.id, { max: 1, time: gamesTime, errors: ['time'] });
  305. collector.on('collect', r => {
  306. if (r.content.startsWith(e[c].ans)){
  307. const embed = new Discord.RichEmbed()
  308. .setDescription('✅ | **``صح عليك``** \n `+150 Credit` \n \n `لقد اتممت الاجابة في :'+`${moment(r.createdTimestamp - message.createdTimestamp).format(`ss`)}`+" ثانية`")
  309. .setColor('RANDOM')
  310. message.channel.send(embed).then(()=>{clearTimeout(mm1)})
  311.  
  312. sql.run(`UPDATE scores SET credit = ${row.credit + 150} WHERE userId = ${message.author.id}`);
  313. return;
  314. } else {
  315. const embed = new Discord.RichEmbed()
  316. .setDescription('❌ | **``الاجابة خاطئة``** ')
  317. .setColor('RANDOM')
  318. message.channel.send(embed).then(()=>{clearTimeout(mm1)})
  319. }
  320. })
  321. }
  322. })
  323.  
  324.  
  325. if(message.content.startsWith(prefix+"le") || message.content.startsWith(prefix+"فكك") ){
  326. x = ['القسطنطينية','فلسطين','يوتيوب','بوت','دسكورد','سيرفر','اسبوت','بروبوت','العربية','الأجانب','عبارات','فورتنايت','ببجي موبايل','نينتي ناين','الميااه','قدمين','السيرفرات','الدول','لبنان','سوريا','مصر','الجزائر','العباسيون','الحمدانيون','السيرفر روعة','افضل بوت اسبوت','كريديت اس بوت','الغرب و الشرق','العهد السلجوقي','الحاكم','انه مربى لذيذ و جيد','المحترفون العرب','اكو عرب بالطيارة','فككني انا','السيرفر قمد'];
  327. x2 = ['ا ل ق س ط ن ط ي ن ي ة','ف ل س ط ي ن','ي و ت ي و ب','ب و ت','د س ك و ر د','س ي ر ف ر','ا س ب و ت','ب ر و ب و ت','ا ل ع ر ب ي ة','ا ل أ ج ا ن ب','ع ب ا ر ا ت','ف و ر ت ن ا ي ت','ب ب ج ي م و ب ا ي ل','ن ي ن ت ي ن ا ي ن','ا ل م ي ا ا ه','ق د م ي ن','ا ل س ي ر ف ر ا ت','ا ل د و ل','ل ب ن ا ن','س و ر ي ا','م ص ر','ا ل ج ز ا ئ ر','ا ل ع ب ا س ي و ن','ا ل ح م د ا ن ي و ن','ا ل س ي ر ف ر ر و ع ة','ا ف ض ل ب و ت ا س ب و ت','ك ر ي د ي ت ا س ب و ت','ا ل غ ر ب و ا ل ش ر ق','ا ل ع ه د ا ل س ل ج و ق ي','ا ل ح ا ك م','ا ن ه م ر ب ى ل ذ ي ذ و ج ي د','ا ل م ح ت ر ف و ن ا ل ع ر ب','ا ك و ع ر ب ب ا ل ط ي ا ر ة','ف ك ك ن ي ا ن ا','ا ل س ي ر ف ر ق م د'];
  328. var x3 = Math.floor(Math.random()*x.length)
  329.  
  330. var fkkemb = new Discord.RichEmbed()
  331. .setAuthor(`📋 SBot Games | فكك`, message.guild.iconURL)
  332. .setTitle(`**\`${x[x3]}\`**`)
  333. .setFooter(message.author.username, message.author.avatarURL)
  334.  
  335. message.channel.send(fkkemb)
  336. message.channel.stopTyping();
  337.  
  338. var mm1=setTimeout(() =>{
  339. const embed = new Discord.RichEmbed()
  340. .setColor(0xff0000)
  341. .setDescription(" :stopwatch: | ` انتهى الوقت `")
  342. message.channel.sendEmbed(embed);
  343. if(row.pointsFkk <= 0 )return;
  344. },gamesTime);
  345.  
  346. const collector = new Discord.MessageCollector(message.channel, m => m.author.id == message.author.id, { max: 1, time: gamesTime, errors: ['time'] });
  347. collector.on('collect', r => {
  348. if (r.content == x2[x3]){
  349. const embed = new Discord.RichEmbed()
  350. .setDescription('✅ | **``صح عليك``** \n `+100 Credits` \n \n `لقد اتممت الاجابة في :'+`${moment(r.createdTimestamp - message.createdTimestamp).format(`ss`)}`+" ثانية`")
  351. .setColor('RANDOM')
  352. message.channel.send(embed).then(()=>{clearTimeout(mm1)})
  353.  
  354. sql.run(`UPDATE scores SET credit = ${row.credit + 100} WHERE userId = ${message.author.id}`);
  355. return;
  356. } else {
  357. const embed = new Discord.RichEmbed()
  358. .setDescription('❌ | **``الاجابة خاطئة``**')
  359. .setColor('RANDOM')
  360. message.channel.send(embed).then(()=>{clearTimeout(mm1)})
  361. }
  362. })
  363.  
  364. }
  365. if (message.content.startsWith(prefix+"fa") || message.content.startsWith(prefix+"سرعة") ) {
  366. y = ['دًيسكًَورد','الله اكًبًر','سبًحاًن الله','بسًًًًًًًم الله','مًًًًًصر','السعًًًًًًًودُُُُُُية','الًَُبرمجة حًَُياتي','ذهب محًُمد الى الًُمدرسة','اًن الله يًُحب المؤمًُنين','اينًَُشتاين','بريطاًَنيا','ابو بًَكر الصديق','كريستًُيانو','مُيسي','نيُمار','ديبٍالا','فيسٍبوك موٍقع تواصل اجتًماعي','تويتر موقع تواصل اجتٍماعي','انًُستجرام يحًًُبه الجميع','السيزون السابع فوًُرتنايت','فورتًُنايت','مصطفى جًُيم اوفر','لاست مًُودد'];
  367. y2 = ['ديسكورد','الله اكبر','سبحان الله','بسم الله','مصر','السعودية','البرمجة حياتي','ذهب محمد الى المدرسة','ان الله يحب المؤمنين','اينشتاين','بريطانيا','ابو بكر الصديق','كريستيانو','ميسي','نيمار','ديبالا','فيسبوك موقع تواصل اجتماعي','تويتر موقع تواصل اجتماعي','انستجرام يحبه الجميع','السيزون السابع فورتنايت','فورتنايت','مصطفى جيم اوفر','لاست مودد'];
  368. var y3 = Math.floor(Math.random()*y.length)
  369.  
  370. var fastem = new Discord.RichEmbed()
  371. .setAuthor(`📋 SBot Games | اسرع كتابة`, message.guild.iconURL)
  372. .setTitle(`**\`${y[y3]}\`**`)
  373. .setDescription(`اكتبها بلا حركات`)
  374. .setFooter(message.author.username, message.author.avatarURL)
  375.  
  376. message.channel.send(fastem)
  377. message.channel.stopTyping();
  378.  
  379. var mm1=setTimeout(() =>{
  380. const embed1 = new Discord.RichEmbed()
  381. .setColor(0xff0000)
  382. .setDescription(" :stopwatch: | ` انتهى الوقت `")
  383. message.channel.sendEmbed(embed1);
  384. if(row.pointsFkk <= 0 )return;
  385. },gamesTime);
  386.  
  387. const collector = new Discord.MessageCollector(message.channel, m => m.author.id == message.author.id, { max: 1, time: gamesTime, errors: ['time'] });
  388. collector.on('collect', r => {
  389. if (r.content == y2[y3]){
  390. const embed2 = new Discord.RichEmbed()
  391. .setDescription('✅ | **``صح عليك``** \n `+100 Credits` \n \n `لقد اتممت الاجابة في :'+`${moment(r.createdTimestamp - message.createdTimestamp).format(`ss`)}`+" ثانية`")
  392. .setColor('RANDOM')
  393. message.channel.send(embed2).then(()=>{clearTimeout(mm1)})
  394.  
  395. sql.run(`UPDATE scores SET credit = ${row.credit + 100} WHERE userId = ${message.author.id}`);
  396. return;
  397. } else {
  398. const embed3 = new Discord.RichEmbed()
  399. .setDescription('❌ | **``الاجابة خاطئة``** ')
  400. .setColor('RANDOM')
  401. message.channel.send(embed3).then(()=>{clearTimeout(mm1)})
  402. }
  403. })
  404.  
  405. }
  406.  
  407. if (message.content == prefix+"ma" || message.content == prefix+"حساب") {
  408. m = ['13*10','(50/10)*1','25*3','90/2','9/9','5-4+3-2+1','15/5','50*3','(5*2)+(2*3)','1111*1','2*9*1','((10+10)*0)+20','11+9+1','(5+5+5+5*1)+2','(15*2)+1','(39+1)*0','(22+1+3)*2','(5-4)-1','(9*2)+1','10-8','100/10','999+1.5','5+1+9','2*2'];
  409. m2 = ['130','5','75','45','1','3','3','150','16','1111','18','20','21','22','31','0','52','0','19','2','10','1000.5','15','4'];
  410. var m3 = Math.floor(Math.random()*m.length)
  411.  
  412. var mathem = new Discord.RichEmbed()
  413. .setAuthor(`📋 SBot Games | رياضيات`, message.guild.iconURL)
  414. .setTitle(`**\`${m[m3]}\`**`)
  415. .setFooter(message.author.username, message.author.avatarURL)
  416.  
  417. message.channel.send(mathem)
  418. message.channel.stopTyping();
  419.  
  420. var mm1=setTimeout(() =>{
  421. const embed5 = new Discord.RichEmbed()
  422. .setColor(0xff0000)
  423. .setDescription(" :stopwatch: | ` انتهى الوقت `")
  424. message.channel.sendEmbed(embed5);
  425. if(row.pointsFkk <= 0 )return;
  426. },gamesTime);
  427.  
  428. const collector = new Discord.MessageCollector(message.channel, m => m.author.id == message.author.id, { max: 1, time: gamesTime, errors: ['time'] });
  429. collector.on('collect', r => {
  430. if (r.content == m2[m3]){
  431. const embed6 = new Discord.RichEmbed()
  432. .setDescription('✅ | **``صح عليك``** \n `+100 Credits` \n \n `لقد اتممت الاجابة في :'+`${moment(r.createdTimestamp - message.createdTimestamp).format(`ss`)}`+" ثانية`")
  433. .setColor('RANDOM')
  434. message.channel.send(embed6).then(()=>{clearTimeout(mm1)})
  435.  
  436. sql.run(`UPDATE scores SET credit = ${row.credit + 100} WHERE userId = ${message.author.id}`);
  437. return;
  438. } else {
  439. const embed7 = new Discord.RichEmbed()
  440. .setDescription('❌ | **``الاجابة خاطئة``** ')
  441. .setColor('RANDOM')
  442. message.channel.send(embed7).then(()=>{clearTimeout(mm1)})
  443. }
  444. })
  445.  
  446. }
  447.  
  448.  
  449.  
  450. if(message.content.startsWith(prefix + "casino")) {
  451. if(row.credit < 999) return message.reply(`**:x: | ليس لديك المبلغ المطلوب للعب هذه اللعبة**`);
  452.  
  453. let micas = ['-','+' , '-', '-', '-', '-', '-','+', '-', '-']
  454. let micas1 = `${micas[Math.floor(Math.random() * micas.length)]}`
  455. let first = Math.floor(Math.random() * 9);
  456. let second = Math.floor(Math.random() * 9);
  457. let third = Math.floor(Math.random() * 9);
  458. let num = `${micas1}${first}${second}${third}`;
  459.  
  460. var casino = new Discord.RichEmbed()
  461. .setAuthor(message.author.username, message.author.avatarURL)
  462. .setTitle(`** :moneybag: , Casino**`)
  463. .setDescription(`**كم بكتابه اي شيء عشوائي**`)
  464. .setFooter('**Sbot**')
  465.  
  466. message.channel.send(casino).then(m => {
  467.  
  468. message.channel.awaitMessages(r => r.author.id === message.author.id, { max: 1, time: 20000, errors:['time'] }).then(collected => {
  469.  
  470. let c = collected.first();
  471. if(c.content === num) {
  472.  
  473.  
  474. } else {
  475. message.channel.send(`**لقد حصلــت على \`${num}\` كرديت**`)
  476. sql.run(`UPDATE scores SET credit = ${row.credit + num} WHERE userId = ${message.author.id}`);
  477.  
  478. }
  479.  
  480.  
  481.  
  482. });
  483. })
  484. }
  485.  
  486.  
  487. })
  488. })
  489. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement