Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const ms = rquire('ms')
- const cool = [];
- client.on('message',async message => {
- if(message.author.bot) return;
- if(message.channel.type === 'dm') return;
- const guildid = "595231357873946627"; // ايدي السيرفر الي موجود فيه الروم
- const channelid = "599221947569537045"; // ايدي الروم
- var prefix = ".";
- const args = message.content.split(' ');
- const credits = require('./credits.json');
- const path = './credits.json';
- const mention = message.mentions.users.first() || client.users.get(args[1]) || message.author;
- const mentionn = message.mentions.users.first() || client.users.get(args[1]);
- const author = message.author.id;
- const balance = args[2];
- const daily = Math.floor(Math.random() * 350) + 10;
- if(!credits[author]) credits[author] = {credits: 50};
- if(!credits[mention.id]) credits[mention.id] = {credits: 50};
- fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
- if(message.content.startsWith(prefix + "credits")) {
- if(args[0] !== `${prefix}credit` && args[0] !== `${prefix}credits`) return;
- if(args[2]) {
- if(isNaN(args[2])) return message.channel.send('**:heavy_multiplication_x:| This field should consist of numbers and not letters .**');
- if(mention.bot) return message.channel.send(`**:heavy_multiplication_x:| ${message.content.split(' ')[1]} Not found **`);
- if(mention.id === message.author.id) return message.channel.send('**:heavy_multiplication_x:| You can not convert credits for yourself **');
- if(credits[author].credits < balance) return message.channel.send('**:heavy_multiplication_x:| Your balance is not enough for that! **');
- var one = Math.floor(Math.random() * 9) + 1;
- var two = Math.floor(Math.random() * 9) + 1;
- var three = Math.floor(Math.random() * 9) + 1;
- var four = Math.floor(Math.random() * 9) + 1;
- var number = `${one}${two}${three}${four}`;
- message.channel.send(`**| :moneybag: \`${number}\`, type these numbers to confirm**`).then(m => {
- message.channel.awaitMessages(m => m.author.id === message.author.id, {max: 1, time: 10000}).then(c => {
- if(c.first().content === number) {
- m.delete();
- message.channel.send(`**:moneybag:| ${message.author.username}, has transferred \`${balance}\` to ${mention}**`)
- var sendembed = new Discord.RichEmbed()
- .setColor('RANDOM')
- .setTitle(`عملية تحويل جديدة`)
- .addField(`${message.author.username}#${message.author.discriminator}:اسم والتاق المرسل\n${message.author.id} :ايدي المرسل\n${mention.username}#${mention.discriminator}: اسم والتاق المستقبل\n ${mention.id}:ايدي المستقبل\n ${balance} : المبلغ\n${moment(message.createdAt).format('D/MM/YYYY h:mm')} : تم التحويل في`, client.user.username)
- client.guilds.get(guildid).channels.get(channelid).send(sendembed);
- credits[author].credits += (-balance);
- credits[mention.id].credits += (+balance);
- fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
- } else if(c.first().content !== number) {
- m.delete();
- message.channel.send(`** :moneybag: | Sending canceled **`);
- }
- });
- });
- }
- if(!args[2]) {
- if(mention.bot) return message.channel.send(`**:heavy_multiplication_x:| ${message.content.split(' ')[1]} لم يتم العثور على**`);
- message.channel.send(`**${mention.username}, your :credit_card: balance is \`\`$${credits[mention.id].credits}\`\`.**`); }
- }
- if(message.content.startsWith(prefix + "daily")) {
- if(cool.includes(message.author.id)) return message.channel.send(`**:stopwatch: | ${mention.username} \ , your daily :yen: credits refreshes in 24 hours **`);
- if(mentionn) {
- var one = Math.floor(Math.random() * 9) + 1;
- var two = Math.floor(Math.random() * 9) + 1;
- var three = Math.floor(Math.random() * 9) + 1;
- var four = Math.floor(Math.random() * 9) + 1;
- var number = `${one}${two}${three}${four}`;
- message.channel.send(`**:atm: | \`${number}\`, type these numbers to confirm **`).then(async m => {
- message.channel.awaitMessages(msg => msg.author.id === message.author.id, {max: 1, time: 20000, errors: ['time']}).then(collected => {
- if(collected.first().content === number) {
- m.delete();
- collected.first().delete();
- credits[mentionn.id].credits += (+daily);
- fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
- message.channel.send(`**:atm: | \`${daily}\`, you received your :yen:**`)
- }
- if(collected.first().content !== number) {
- return m.delete();
- }
- });
- });
- } else if(!mentionn) {
- credits[author].credits += (+daily);
- fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
- var dailyembed = new Discord.RichEmbed()
- .setColor('RANDOM')
- .setTitle(`شخص استلم ديلي جديد`)
- .addField(`${message.author.username}#${message.author.discriminator} :اسم والتاق المستقبل\n${message.author.id} :ايدي المستقبل\n${daily} :المبلغ المستلم`, client.user.username);
- client.guilds.get(guildid).channels.get(channelid).send(dailyembed)
- message.channel.send(`**:atm: | , you received your :yen: \`${daily}\` daily credits! **`);
- }
- cool.unshift(message.author.id);
- setTimeout(() => {
- cool.shift(message.author.id);
- message.author.send("**:atm: | \`Daily\`, يمكنك الحصول على الكردت المجانية الان**").catch();
- }, ms("1d"));
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement