Answer the question
In order to leave comments, you need to log in
Doubling XP for each message for a certain time, how to do?
I would like for the purchase of a certain product the amount of XP for each message doubled, that is, for example, I received 5 XP, instead of 1.
The code:
bot.send = function (msg){
message.channel.send(msg);
};
if (!profile[uid]){ //Если нету профиля, создаем
profile[uid] = {
sms:0,
xp:0,
lvl:0,
coins:0,
boost:0,
};
};
let u = profile[uid];
u.sms++; //Подчет сообщений участника
u.xp++;
u.coins++; //За каждое сообщение по монетке)
if(u.xp>= (u.lvl * 50)){
u.xp = 0;
u.lvl += 1;
u.coins += 15;
const embed = new Discord.RichEmbed()
.setTitle('Уровень повышен!')
.setColor('RANDOM')
.setAuthor(`${message.author.username}`, `${message.author.avatarURL}`)
.setThumbnail("https://yt3.ggpht.com/a/AATXAJyYHKi-N8rzQ8BNwnndpRNAVSTol-lRboG3WA=s900-c-k-c0xffffffff-no-rj-mo")
// Set the main content of the embed
.setDescription(`Поздравляю,твой уровень был повышен до **${u.lvl}** , удачи!
За повышение уровня вам выдано **15 коинов**. Ваш текущий баланс - **${u.coins} коинов(а)**`)
.setFooter(`Футер,просто футер.`,`${bot.user.avatarURL}`)
// Send the embed to the same channel as the message
message.channel.send(embed);
};
const Discord = require('discord.js')
let profile = require("../profile.json");
module.exports.run = async (bot, message, args,) => {
let uid = message.author.id;
let u = profile[uid];
let amount = Math.floor(Math.random() * 75) + 5;
if (args[0] == 'help') {
let embed = new Discord.RichEmbed()
.setTitle("Список товаров:")
.setColor('#e22216')
.setThumbnail("https://static.vecteezy.com/system/resources/previews/000/290/438/original/balance-vector-icon.jpg")
.setAuthor(`${message.author.username}`, `${message.author.avatarURL}`)
.setDescription(`
**upxp** - Пакет XP. Выдаёт от **5-ти до 75-ти XP.**
Цена - **450** коинов за товар.
**prempack** - Скоро...
`)
.setFooter(`Использование команды - !shop товар (help для списка товаров)`,`${bot.user.avatarURL}`);
message.channel.send(embed);
}
if (args[0] == 'upxp') {
if(u.coins < 450) {
message.reply("Недостаточно монет!\n!bal - проверка баланса")
}
if(u.coins >= 333) {
message.channel.send(`**Товар успешно куплен!** Вам выдано **${amount}** XP
С вашего счёта списано **450** коинов. Текущий баланс - **${u.coins}** коина(ов).`)
u.coins -= 450;
u.xp += amount;
}
}
if (args[0] == 'prempack') {
message.channel.send("На данный момент недоступно")
}
};
module.exports.help = {
name: "shop"
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question