discord-voice / discord-voice Goto Github PK
View Code? Open in Web Editor NEW⏲️ A complete framework to facilitate the tracking of user voice time using discord.js
Home Page: https://discord-voice.js.org
⏲️ A complete framework to facilitate the tracking of user voice time using discord.js
Home Page: https://discord-voice.js.org
I was thinking of something like { channelid: voicetimeinms, 2ndchannelid: voicetimeinms }
just stop botting them
I'm assuming, due to Discord update, the detection for the voiceStateUpdate is no longer working in the module.
Under discord-voice\src\Manager.js
, line 431 for the _checkUsers()
function.
The actual if condition is (user.member && user.channel)
but client and voiceManager objects changed since so the module don't detect any member nor channel.
In my case, I edited the module as followed:
Fetching the user before:
const user = await u.client.guilds.cache.get(u.guildId).members.cache.get(u.userId);
And checking if there's an user and if the user is in a voice channel.
if (user && user.voice.channel) {
By editing the module like this, you will need to edit the code below aswell.
Add a check that allows you to turn off the voice activity reading if the user's microphone is turned off
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;
}
You are creating schema 'Messages' to store the voice data, but you're using that in your discord-messages
package too
Hello! If anybody is interested to maintain this package let me know!
I am busy with my college so I won't be able to push much updates to discord-voice.
It is possible to exempt a specific user from being tracked ? and track all the other ones
Greetings, if not difficult, please add such functions, the ability to add channels where the system will not read online and the ability to specify the minimum number of users in voice channels to get started.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.