We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add graphics, example screen and some code
let embed = new MessageEmbed() .setAuthor(message.author.username, message.author.avatarURL({ dynamic: true })) .setFooter(`${message.guild.name} root prod.`) let day = await tm.getDay(message.guild.id); embed.setDescription(`${message.guild.name}** день ${day}** .`); embed.setColor("2f3136"); Stat.aggregate([ {$project: {Message: 0}}, { $sort: { AllVoice: -1 } } ]).limit(10).exec(async (err, docs) => { if (err) return message.reply("произошла ошибка."); let users = [], usersToEmbed = []; if (docs.length > 0) { for (let index = 0; index < docs.length; index++) { const doc = docs[index]; let stat = doc; if (!stat) continue; if (stat.AllVoice <= 0) continue; if (stat.Voice) { let days = Object.keys(stat.Voice); let dataValues = new Array(day).fill(0); days.forEach(_day => { let sum = Object.values(stat.Voice[_day]).reduce((x, y) => x + y, 0); dataValues[_day - 1] = (sum / (1000 * 60)); }); let user = (await Helper.GetUser(doc.Id)); usersToEmbed.push({ User: user, Value: dataValues.reduce((x, y) => x + y, 0) }); let borderColors = new Array(dataValues.length).fill(getColor(index, "0.8")); let backgroundColors = new Array(dataValues.length).fill(getColor(index, "0.1")) let pointBackgroundColors = new Array(dataValues.length).fill(getColor(index, "1")); let data = { label: `${user.username}`, data: dataValues, backgroundColor: backgroundColors, borderColor: borderColors, pointBackgroundColor: pointBackgroundColors, borderWidth: 1.5, }; users.push(data); } } let dataDate = []; for (let index = 0; index < day; index++) { let date = new Date(Date.now() - (1000 * 60 * 60 * 24 * (day - (index + 1)))); } let buffer = await cm.ImageFromData({ width: 600, height: 290, type: 'line', data: { labels: [].concat(dataDate), datasets: users }, options: { legend: { labels: { fontColor: '#ffffff', fontSize: 20 } } } }); embed.addField(`Топ по голосовой активности`, usersToEmbed.map((val, index) => `\`${index + 1}.\` ${val.User}(${val.User.username}): \`${moment.duration(val.Value * (1000 * 60)).format("H [ч., ] m [мин.]")}\``).join("\n")) embed.setImage("attachment://Graph.png"); let attachment = new MessageAttachment(buffer, "Graph.png"); message.channel.csend({ embeds: [embed], files: [attachment] }); } else { embed.addField("Нет данных.", "** **"); return message.csend(embed); } }); } const colors = [ 'rgba(240, 255, 0, <f>)', 'rgba(147, 255, 0, <f>)', 'rgba(0, 255, 4, <f>)', 'rgba(0, 255, 182, <f>)', 'rgba(0, 240, 255, <f>)', 'rgba(0, 124, 255, <f>)', 'rgba(81, 0, 255, <f>)', 'rgba(182, 0, 255, <f>)', 'rgba(255, 0, 220, <f>)', 'rgba(255, 0, 85, <f>)', ] function getColor(index, x) { let color = colors[index].replace("<f>", x); return color; }
The text was updated successfully, but these errors were encountered:
Interesting I will see what I can do! Thanks for providing the code it helps alot
Sorry, something went wrong.
Might add this in the 2.0.0 release since it will have a system dedicated to levels / xp.
Successfully merging a pull request may close this issue.
Add graphics, example screen and some code
![image](https://user-images.githubusercontent.com/68510813/114886664-666cbe00-9e10-11eb-90b4-9680d34ff29e.png)
The text was updated successfully, but these errors were encountered: