Advertisement
LH_Lawliet

Untitled

Aug 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.96 KB | None | 0 0
  1. const Discord = require('discord.js')
  2. const bot = new Discord.Client()
  3.  
  4.  
  5. var mysql = require('mysql');
  6.  
  7. var con = mysql.createConnection({
  8. host: "127.0.0.1",
  9. user: "root",
  10. password: "",
  11. database: "discord"
  12. });
  13.  
  14. bot.on('ready', function () {
  15. console.log("Je suis connecté !")
  16. })
  17.  
  18. bot.login('MzQ4NDg5MTQ1NDAxODY4Mjg5.DHo9LA.u_YUrrfF__7vFR-ksKGX4LcFhOc')
  19.  
  20.  
  21. bot.on('message', message => {
  22. if (message.content === '!cheat') {
  23. discordid=message.author.id
  24. var sql = "UPDATE user SET money = 500000000000000 WHERE id ="+discordid+"";
  25. con.query(sql, function (err, result) {
  26. if (err) throw err;
  27. console.log(result.affectedRows + " record(s) updated");
  28. });
  29. }
  30. })
  31.  
  32.  
  33.  
  34. bot.on('message', message => {
  35. if (message.content === '!help') {
  36. message.reply('Il y a énormément de commande comme !')
  37. message.reply('!ping')
  38. message.reply('!random')
  39. message.reply('!bonjour')
  40. message.reply('!info')
  41. message.reply('plein d autre en dev')
  42. }
  43. })
  44.  
  45.  
  46. bot.on('message', message => {
  47. if (message.content === '!ping') {
  48. message.reply('pong !')
  49. }
  50. })
  51.  
  52.  
  53.  
  54. // Create an event listener for messages
  55. bot.on('message', message => {
  56. // If the message is "what is my avatar"
  57. if (message.content === '!info') {
  58. // Send the user's avatar URL
  59. message.reply('ton avatar est '+message.author.avatarURL);
  60. message.reply('ton id est '+message.author.id);
  61. message.reply('ton pseudo est '+message.author.username);
  62. }
  63. });
  64.  
  65. // Create an event listener for messages
  66. bot.on('message', message => {
  67. // If the message is "ping"
  68. if (message.content === '!bonjour') {
  69. // Send "pong" to the same channel
  70. message.reply('aurevoir');
  71. }
  72. });
  73.  
  74.  
  75.  
  76. bot.on('message', message => {
  77. // If the message is "what is my avatar"
  78. if (message.content === '!addmoney') {
  79. discordid=message.author.id
  80. var sql = "INSERT INTO user (id, money) VALUES ("+discordid+", '2000')";
  81. con.query(sql, function (err, result) {
  82. if (err) throw err;
  83. console.log("money inserted");
  84. });
  85. };
  86. })
  87.  
  88.  
  89. bot.on('message', message => {
  90.  
  91. if (message.content === '!bankbalance') {
  92. discordid=message.author.id
  93. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  94. if (err) throw err;
  95. console.log(result);
  96. message.reply("tu a "+result[0].money+" points");
  97. });
  98. };
  99.  
  100. })
  101.  
  102.  
  103.  
  104. bot.on('message', message => {
  105. if (message.content === '!random') {
  106.  
  107. var random = Math.floor((Math.random() * 14) + 1);
  108.  
  109. if (random == 1) {
  110.  
  111. discordid=message.author.id
  112. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  113. if (err) throw err;
  114. console.log(result);
  115. moneyofuser=result[0].money
  116. console.log(result[0].money);
  117. moneyofuser=moneyofuser*5
  118. message.reply('As (money*5)')
  119. message.reply(moneyofuser)
  120. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  121. con.query(sql, function (err, result) {
  122. if (err) throw err;
  123. console.log(result.affectedRows + " record(s) updated");
  124. });
  125.  
  126. });
  127. }
  128. else if (random == 2) {
  129.  
  130. discordid=message.author.id
  131. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  132. if (err) throw err;
  133. console.log(result);
  134. moneyofuser=result[0].money
  135. console.log(result[0].money);
  136. moneyofuser=moneyofuser/10
  137. message.reply('tu a eu un 2 (money/10)')
  138. message.reply(moneyofuser)
  139. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  140. con.query(sql, function (err, result) {
  141. if (err) throw err;
  142. console.log(result.affectedRows + " record(s) updated");
  143. });
  144. });
  145. }
  146. else if (random == 3) {
  147.  
  148. discordid=message.author.id
  149. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  150. if (err) throw err;
  151. console.log(result);
  152. moneyofuser=result[0].money
  153. console.log(result[0].money);
  154. moneyofuser=moneyofuser/2
  155. message.reply('tu a eu un 3 (money/2)')
  156. message.reply(moneyofuser)
  157. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  158. con.query(sql, function (err, result) {
  159. if (err) throw err;
  160. console.log(result.affectedRows + " record(s) updated");
  161. });
  162. });
  163. }
  164. else if (random == 4) {
  165.  
  166. discordid=message.author.id
  167. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  168. if (err) throw err;
  169. console.log(result);
  170. moneyofuser=result[0].money
  171. console.log(result[0].money);
  172. moneyofuser=moneyofuser/2
  173. message.reply('tu a eu un 4 (money/2)')
  174. message.reply(moneyofuser)
  175. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  176. con.query(sql, function (err, result) {
  177. if (err) throw err;
  178. console.log(result.affectedRows + " record(s) updated");
  179. });
  180. });
  181. }
  182. else if (random == 5) {
  183.  
  184. discordid=message.author.id
  185. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  186. if (err) throw err;
  187. console.log(result);
  188. moneyofuser=result[0].money
  189. console.log(result[0].money);
  190. moneyofuser=moneyofuser/2
  191. message.reply('tu a eu un 5 (money/2)')
  192. message.reply(moneyofuser)
  193. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  194. con.query(sql, function (err, result) {
  195. if (err) throw err;
  196. console.log(result.affectedRows + " record(s) updated");
  197. });
  198. });
  199. }
  200. else if (random == 6) {
  201.  
  202. discordid=message.author.id
  203. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  204. if (err) throw err;
  205. console.log(result);
  206. moneyofuser=result[0].money
  207. console.log(result[0].money);
  208. moneyofuser=moneyofuser/2
  209. message.reply('tu a eu un 6 (money/2)')
  210. message.reply(moneyofuser)
  211. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  212. con.query(sql, function (err, result) {
  213. if (err) throw err;
  214. console.log(result.affectedRows + " record(s) updated");
  215. });
  216. });
  217. }
  218. else if (random == 7) {
  219.  
  220. discordid=message.author.id
  221. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  222. if (err) throw err;
  223. console.log(result);
  224. moneyofuser=result[0].money
  225. console.log(result[0].money);
  226. moneyofuser=moneyofuser/2
  227. message.reply('tu a eu un 7 (money/2)')
  228. message.reply(moneyofuser)
  229. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  230. con.query(sql, function (err, result) {
  231. if (err) throw err;
  232. console.log(result.affectedRows + " record(s) updated");
  233. });
  234. });
  235. }
  236. else if (random == 8) {
  237.  
  238. discordid=message.author.id
  239. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  240. if (err) throw err;
  241. console.log(result);
  242. moneyofuser=result[0].money
  243. console.log(result[0].money);
  244. moneyofuser=moneyofuser*2
  245. message.reply('tu a eu un 8 (money*2)')
  246. message.reply(moneyofuser)
  247. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  248. con.query(sql, function (err, result) {
  249. if (err) throw err;
  250. console.log(result.affectedRows + " record(s) updated");
  251. });
  252. });
  253. }
  254.  
  255. else if (random == 9) {
  256.  
  257. discordid=message.author.id
  258. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  259. if (err) throw err;
  260. console.log(result);
  261. moneyofuser=result[0].money
  262. console.log(result[0].money);
  263. moneyofuser=moneyofuser*2
  264. message.reply('tu a eu un 9 (money*2)')
  265. message.reply(moneyofuser)
  266. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  267. con.query(sql, function (err, result) {
  268. if (err) throw err;
  269. console.log(result.affectedRows + " record(s) updated");
  270. });
  271. });
  272. }
  273. else if (random == 10) {
  274.  
  275. discordid=message.author.id
  276. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  277. if (err) throw err;
  278. console.log(result);
  279. moneyofuser=result[0].money
  280. console.log(result[0].money);
  281. moneyofuser=moneyofuser*2
  282. message.reply('tu a eu un 10 (money*2)')
  283. message.reply(moneyofuser)
  284. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  285. con.query(sql, function (err, result) {
  286. if (err) throw err;
  287. console.log(result.affectedRows + " record(s) updated");
  288. });
  289. });
  290. }
  291. else if (random == 11) {
  292.  
  293. discordid=message.author.id
  294. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  295. if (err) throw err;
  296. console.log(result);
  297. moneyofuser=result[0].money
  298. console.log(result[0].money);
  299. moneyofuser=moneyofuser*2
  300. message.reply('tu a eu un VALET (money*2)')
  301. message.reply(moneyofuser)
  302. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  303. con.query(sql, function (err, result) {
  304. if (err) throw err;
  305. console.log(result.affectedRows + " record(s) updated");
  306. });
  307. });
  308. }
  309. else if (random == 12) {
  310.  
  311. discordid=message.author.id
  312. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  313. if (err) throw err;
  314. console.log(result);
  315. moneyofuser=result[0].money
  316. console.log(result[0].money);
  317. moneyofuser=moneyofuser*2
  318. message.reply('tu a eu une DAMME (money*2)')
  319. message.reply(moneyofuser)
  320. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  321. con.query(sql, function (err, result) {
  322. if (err) throw err;
  323. console.log(result.affectedRows + " record(s) updated");
  324. });
  325. });
  326. }
  327. else if (random == 13) {
  328.  
  329. discordid=message.author.id
  330. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  331. if (err) throw err;
  332. console.log(result);
  333. moneyofuser=result[0].money
  334. console.log(result[0].money);
  335. moneyofuser=moneyofuser*2
  336. message.reply('tu a eu un ROI (money*2)')
  337. message.reply(moneyofuser)
  338. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  339. con.query(sql, function (err, result) {
  340. if (err) throw err;
  341. console.log(result.affectedRows + " record(s) updated");
  342. });
  343. });
  344. }
  345. else if (random == 14) {
  346.  
  347. discordid=message.author.id
  348. con.query("SELECT money FROM user WHERE id="+discordid+"", function (err, result, fields) {
  349. if (err) throw err;
  350. console.log(result);
  351. moneyofuser=result[0].money
  352. console.log(result[0].money);
  353. moneyofuser=moneyofuser*10
  354. message.reply('tu a eu un JOKER (money*10)')
  355. message.reply(moneyofuser)
  356. message.reply('C`est incroyable tu a eu un JOKER @here')
  357. var sql = "UPDATE user SET money = "+moneyofuser+" WHERE id ="+discordid+"";
  358. con.query(sql, function (err, result) {
  359. if (err) throw err;
  360. console.log(result.affectedRows + " record(s) updated");
  361. });
  362. });
  363. }
  364. }
  365. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement