Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.31 KB | None | 0 0
  1. let profile = JSON.parse(fs.readFileSync("./profile.json", "utf8"))
  2.  
  3. client.on("message", message => {
  4. if (message.author.bot) return;
  5. if(!message.channel.guild)return;
  6. if (!profile[message.author.id]) profile[message.author.id] = {
  7. title: 'title',
  8. rep: 0,
  9. reps: 'NOT YET',
  10. lastDaily:'Not Collected',
  11. level: 0,
  12. xp: 0,
  13. credits: 250,
  14. };
  15. fs.writeFile('./profile.json', JSON.stringify(profile), (err) => {
  16. if (err) console.error(err);
  17. })
  18. });
  19. client.on("message", (message) => {
  20. let men = message.mentions.users.first()
  21. if (message.author.bot) return;
  22. if (message.author.id === client.user.id) return;
  23. if(!message.channel.guild) return;
  24. if(message.content.startsWith(prefix + "credit" || prefix + "credits")) {
  25. if(men) {
  26. if (!profile[men.id]) profile[men.id] = {
  27. lastDaily:'Not Collected',
  28. credits: 250,
  29. };
  30. }
  31. if(men) {
  32. message.channel.send(`** ${men.username}, :credit_card: balance` + " is `" + `$${profile[men.id].credits}` + "`.**")
  33. } else {
  34. message.channel.send(`** ${message.author.username}, *Your* :credit_card: balance` + " is `" + `$${profile[message.author.id].credits}` + "`.**")
  35. }
  36. }
  37. if(message.content.startsWith( prefix + "daily")) {
  38.  
  39.  
  40. if(profile[message.author.id].lastDaily != moment().format('day')) {
  41. profile[message.author.id].lastDaily = moment().format('day')
  42. profile[message.author.id].credits += 250
  43. message.channel.send(`:atm: |**${message.author.username} you collect your \`250\` :credit_card: daily credits!**`)
  44. } else {
  45. message.channel.send(`**:stopwatch: | ${message.author.username}, your daily :credit_card: credits refreshes ${moment().endOf('day').fromNow()}**`)
  46. }
  47. }
  48. let cont = message.content.slice(prefix.length).split(" ");
  49. let args = cont.slice(2);
  50. let sender = message.author
  51. if(message.content.startsWith( prefix + "trans")) {
  52. if (!args[0]) {message.channel.send(``);
  53. return;
  54. }
  55.  
  56. if (isNaN(args[0])) {
  57. message.channel.send(``);
  58. return;
  59. }
  60. if(profile[message.author.id].credits < args[0]) return message.channel.send(`** :thinking: | ${message.author.username}, Your balance is not enough for that!**`)
  61. if(args[0].startsWith("-")) return message.channel.send('**!! I Cant Do it**');
  62. let defineduser = '';
  63. let firstMentioned = message.mentions.users.first();
  64. defineduser = (firstMentioned)
  65.  
  66. if(defineduser.id === message.author.id) return message.channel.send("***Transfering to your self hah ?!***")
  67. var mentionned = message.mentions.users.first();
  68. if (!profile[sender.id]) profile[sender.id] = {}
  69. if (!profile[sender.id].credits) profile[sender.id].credits = 200;
  70. fs.writeFile('./profile.json', JSON.stringify(profile), (err) => {
  71. if (err) console.error(err);
  72. })
  73. var x = ['5587' ,' 9978' , '3785' , '7734' , '9864' , '7681' , '3758' , '7834' , '3489' , '1382' , '7389' , '8762' , '0889' , '0388' , '3316' , '0976' , '8603' , '1842' , '4565' , '9524' , '9524' , '0964' , '5930' , '5678' , '9567' , '6099' , '7058' , '0001' , '1324' , '9834' , '7668' , '0378' , '7055' , '9733' , '9876' , '9846' , '9685' , '8574' , '8975' , '9845' , '9862' , '0069' , '0807' , '0673' , '0813' , '1235' , '6879'];
  74. var x2 = ['5587' ,' 9978' , '3785' , '7734' , '9864' , '7681' , '3758' , '7834' , '3489' , '1382' , '7389' , '8762' , '0889' , '0388' , '3316' , '0976' , '8603' , '1842' , '4565' , '9524' , '9524' , '0964' , '5930' , '5678' , '9567' , '6099' , '7058' , '0001' , '1324' , '9834' , '7668' , '0378' , '7055' , '9733' , '9876' , '9846' , '9685' , '8574' , '8975' , '9845' , '9862' , '0069' , '0807' , '0673' , '0813' , '1235' , '6879'];
  75. var x3 = Math.floor(Math.random()*x.length)
  76. message.channel.send(`** | :credit_card: \`${x[x3]}\` type these numbers to confirm**`).then(msg1=> {
  77. var r = message.channel.awaitMessages(msg => msg.content == x2[x3], { maxMatches : 1, time : 600000, errors : ['time'] })
  78.  
  79. r.catch(() => {
  80. message.delete()
  81. r.delete()
  82. msg1.delete()
  83. r.catch
  84. })
  85. r.then(s=> {
  86. var mando = message.mentions.users.id;
  87. if (!profile[defineduser.id]) profile[defineduser.id] = {}
  88. if (!profile[defineduser.id].credits) profile[defineduser.id].credits = 200;
  89. profile[defineduser.id].credits += (+args[0]);
  90. profile[sender.id].credits += (-args[0]);
  91. let mariam = message.author.username
  92. message.channel.send(`**:credit_card: | ${message.author.username}, has transferrerd ` + "`$" + args[0] + "` to " + `<@${defineduser.id}>**`)
  93. mentionned.send(`:credit_card: | Transfer Receipt \`\`\`You have received $ ${args[0]} from user ${message.author.username} (ID: ${message.author.id})\`\`\``);
  94.  
  95. })
  96. })
  97. }
  98. });
  99.  
  100. client.on("message", message => {
  101. if (!message.content.startsWith(prefix)) return;
  102. if (message.author.bot) return;
  103.  
  104. if (!profile[message.author.id]) profile[message.author.id] = {
  105. level: 1,
  106.  
  107. };
  108. let userData = profile[message.author.id];
  109. userData.points++;
  110.  
  111. let curLevel = Math.floor(0.1 * Math.sqrt(userData.points));
  112. if (curLevel > userData.level) {
  113. // Level up message
  114. userData.level = curLevel;
  115. message.channel.send(`**:up: | ${message.author.username} You leveled up to ${curLevel}**`);
  116. }
  117. if (message.content.startsWith(prefix + "level")) {
  118. message.channel.send(`**${message.author.username} You are level is ${userData.level}**`);
  119. }
  120. fs.writeFile("./profile.json", JSON.stringify(profile), (err) => {
  121. if (err) console.error(err)
  122. });
  123.  
  124. });
  125.  
  126.  
  127. client.on('message', message => {
  128.  
  129. if(message.content.startsWith(prefix + 'rep')) {
  130. if(!message.channel.guild) return;
  131. moment.locale('ar');
  132. var getvalueof = message.mentions.users.first()
  133. if(!getvalueof) return message.channel.send(`**:mag: | ${message.author.username}, the user could not be found. **`);
  134. if(getvalueof.id == message.author.id) return message.channel.send(`**${message.author.username},! you cannot give yourself reputation!**`)
  135. if(profile[message.author.id].reps != moment().format('L')) {
  136. profile[message.author.id].reps = moment().format('L');
  137. profile[getvalueof.id].rep = Math.floor(profile[getvalueof.id].rep+1);
  138. message.channel.send(`** :up: | ${message.author.username} has given ${getvalueof} a reputation point!**`)
  139. } else {
  140. message.channel.send(`**:stopwatch: | ${message.author.username}, \`-Time\` ${moment().endOf('day').fromNow()} **`)
  141. }
  142. }
  143. fs.writeFile('profile.json', JSON.stringify(profile), (err) => {
  144. if (err) console.error(err);
  145. })
  146. });
  147.  
  148.  
  149. client.on('message', message => {
  150. moment.locale('ar-TN');
  151. if(!profile[message.author.id]) profile[message.author.id] ={
  152. points: 0,
  153. level: 1
  154. };
  155. if(message.author.bot) return;
  156. profile[message.author.id].points = Math.floor(profile[message.author.id].points+1);
  157. if(profile[message.author.id].points > 120) {
  158. profile[message.author.id].points = 0
  159. profile[message.author.id].level = Math.floor(profile[message.author.id].level+1);
  160. message.channel.send(`**${message.author.username}, <a:Emoji:603642872151146497> لقد وصلت للمستوى __${profile[message.author.id].level}__**`)
  161. }
  162. fs.writeFile('profile.json', JSON.stringify(profile), (err) => {
  163. if (err) console.error(err);
  164. })
  165. });
  166.  
  167. client.on('message', message => {
  168. let tit = message.content.split(" ").slice(1).join(" ");
  169. if(message.content.startsWith(prefix + "title")) {
  170. if(!profile[message.author.id].tite) profile[message.author.id].tite = "Hey im using Super"
  171. if(!tit) {
  172. message.channel.send("**Usage: <title <something>**");
  173. } else {
  174. profile[message.author.id].tite = tit
  175. message.channel.send(`:ok:`)
  176. }
  177. }
  178. fs.writeFile('profile.json', JSON.stringify(profile), (err) => {
  179. if (err) console.error(err);
  180. })
  181. })
  182.  
  183.  
  184.  
  185.  
  186. client.on("message", message => {
  187. if (message.author.bot) return;
  188. if(!message.channel.guild) return;
  189. if (message.content.startsWith(prefix + "profile")) {
  190. let user = message.mentions.users.first();
  191. var men = message.mentions.users.first();
  192. var heg;
  193. if(men) {
  194. heg = men
  195. } else {
  196. heg = message.author
  197. }
  198. var mentionned = message.mentions.members.first();
  199. var h;
  200. if(mentionned) {
  201. h = mentionned
  202. } else {
  203. h = message.member
  204. }
  205. var ment = message.mentions.users.first();
  206. var getvalueof;
  207. if(ment) {
  208. getvalueof = ment;
  209. } else {
  210. getvalueof = message.author;
  211. }
  212. var mentionned = message.mentions.users.first();
  213.  
  214. var client;
  215. if(mentionned){
  216. var client = mentionned;
  217. } else {
  218. var client = message.author;
  219.  
  220. }
  221. if (!profile[getvalueof.id]) profile[getvalueof.id] = {points: 0,reps: "NOT YET",credits: 1, level: 1,title: "HypeLC User", rep: 0, lastDaily: "NOT COLLECTED"};
  222. let Image = Canvas.Image,
  223. canvas = Canvas.createCanvas(300, 300),
  224. ctx = canvas.getContext('2d');
  225. fs.readFile("profile.jpg", function (err, Background) { //امتداد الصورة
  226. if (err) return console.log(err);
  227. let BG = Canvas.Image;
  228. let ground = new Image;
  229. ground.src = Background;
  230. ctx.drawImage(ground, 0, 0, 300, 300); // حجم الصورة
  231.  
  232. })
  233.  
  234.  
  235.  
  236. let url = getvalueof.displayAvatarURL.endsWith(".webp") ? getvalueof.displayAvatarURL.slice(5, -20) + ".png" : getvalueof.displayAvatarURL;
  237. jimp.read(url, (err, ava) => {
  238. if (err) return console.log(err);
  239. ava.getBuffer(jimp.MIME_PNG, (err, buf) => {
  240. if (err) return console.log(err);
  241.  
  242.  
  243. //ur name
  244. ctx.font = 'bold 16px kathen'; // حجم الخط و نوعه
  245. ctx.fontSize = '40px'; // عرض الخط
  246. ctx.fillStyle = "#f1f1f1"; // لون الخط
  247. ctx.textAlign = "center"; // محاذا ة النص
  248. ctx.fillText(`${getvalueof.username}`, 151, 171) // احداثيات اسمك
  249.  
  250. //credit
  251. ctx.font = "bold 12px kathen" // نوع الخط وحجمه
  252. ctx.fontSize = '10px'; // عرض الخط
  253. ctx.fillStyle = "#f1f1f1" // لون الخط
  254. ctx.textAlign = "center"; // محاذا ة النص
  255. ctx.fillText(`$${profile[getvalueof.id].credits}`, 81, 159) // احداثيات المصاري
  256.  
  257. //xp
  258. ctx.font = "bold 12px kathen" // ن
  259. ctx.fontSize = '10px'; // عرض الخطوع الخط وحجمه
  260. ctx.fillStyle = "#f1f1f1" // لون الخط
  261. ctx.textAlign = "center"; // محاذا ة النص
  262. ctx.fillText(`${profile[getvalueof.id].xp}`, 221, 159) // احداثيات النقاط
  263.  
  264. //Level
  265. ctx.font = "bold 27px kathen" // نوع الخط و حجمه
  266. ctx.fontSize = '10px'; // عرض الخط
  267. ctx.fillStyle = "#f1f1f1" // لون الخط
  268. ctx.textAlign = "center"; // محاذا ة النص
  269. ctx.fillText(`${profile[getvalueof.id].level}`, 221, 118) // احداثيات اللفل
  270.  
  271. //Title
  272. ctx.font = "bold 12px kathen" // ن
  273. ctx.fontSize = '15px'; // عرض الخطوع الخط وحجمه
  274. ctx.fillStyle = "#000000" // لون الخط
  275. ctx.textAlign = "center"; // محاذا ة النص
  276. ctx.fillText(`${profile[getvalueof.id].title}`, 150, 199) // احداثيات النقاط
  277.  
  278. // REP
  279. ctx.font = "bold 26px kathen";
  280. ctx.fontSize = "50px";
  281. ctx.fillStyle = "#f1f1f1";
  282. ctx.textAlign = "center";
  283. ctx.fillText(`+${profile[getvalueof.id].rep}`, 80,117) // احداثيات الريب
  284.  
  285. let Avatar = Canvas.Image;
  286. let ava = new Avatar;
  287.  
  288. ava.src = buf;
  289. ctx.beginPath();
  290. ctx.arc(75, 100, 780, 0, Math.PI*2, true);
  291. ctx.closePath();
  292. ctx.clip();
  293. ctx.drawImage(ava, 116, 82, 72, 72);
  294.  
  295. message.channel.startTyping()
  296. message.channel.sendFile(canvas.toBuffer())
  297. message.channel.stopTyping()
  298. })
  299. })
  300. }
  301. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement