Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('message', async message => {
- const db = require('quick.db')
- let user = message.mentions.users.first() || message.author;
- let author = message.author;
- let coins = db.get(`coins_${user.id}`);
- const args = message.content.split(' ');
- const balance = args[2];
- const daily = Math.floor(Math.random() * 3000) + 1;
- const ms = require("ms")
- if (!coins) {
- db.set(`coins_${user.id}`, '50');
- }
- if (message.content.startsWith(prefix + "coins")) {
- if (args[2]) {
- if (user.bot) return message.channel.send(`**:interrobang: | ${message.author.username}, I can\'t find' ${message.content.split(' ')[1]}!**`);
- }
- if (!args[2]) {
- if (user.bot) return message.channel.send(`**Bots dosn\'t have coins**`);
- message.channel.send(`**${user.username}, balance is **\`${coins}\``);
- }
- } else {
- if (message.content.startsWith(prefix + "pay")) {
- if (!coins) {
- db.set(`coins_${user.id}`, '50');
- }
- if (isNaN(args[2])) return message.channel.send(`**:interrobang: | ${message.author.username}, type the coins you need to transfer!**`);
- if (user.id === message.author.id) return message.channel.send('**You can\'t transfer coins to your self**');
- if (coins < balance) return message.channel.send(`**:thinking: | ${message.author.username}, Your balance is not enough for that!**`);
- let one = Math.floor(Math.random() * 9) + 1;
- let two = Math.floor(Math.random() * 9) + 1;
- let three = Math.floor(Math.random() * 9) + 1;
- let four = Math.floor(Math.random() * 9) + 1;
- let verfyNum = `${one}${two}${three}${four}`;
- message.channel.send(`**:heavy_dollar_sign:| please type this \`${verfyNum}\`**`).then(msg => {
- message.channel.awaitMessages(msg => msg.author.id === message.author.id, { max: 1, time: 10000 }).then(c => {
- if (c.first().content === verfyNum) {
- msg.delete();
- message.channel.send(`**:moneybag: | ${message.author.username}, has transferred \`${balance}\` to ${user}**`);
- db.set(`coins_${author.id}`, coins - balance);
- db.set(`coins_${user.id}`, coins - (-balance))
- } else if (c.first().content !== verfyNum) {
- msg.delete();
- }
- });
- });
- } else {
- if (message.content.startsWith(prefix + "daily")) {
- let timeout = 8.64e+7;
- let dailyTime = await db.fetch(`dailyTime_${author.id}`);
- if (dailyTime === null) dailyTime = 0;
- if (dailyTime !== null && timeout - (Date.now() - dailyTime) > 0) {
- let time = timeout - (Date.now() - dailyTime)
- let timeh = ms(time, { long: true });
- message.channel.send(`**Please Try Again After :** \`${timeh}\``)
- } else {
- await db.set(`dailyTime_${author.id}`, Date.now());
- message.channel.send(`**You\'ve claimed\`${daily}\` for today**`);
- db.set(`coins_${user.id}`, coins - (-daily))
- }
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement