[英]How would I show voice hours in server and messages sent in server in my !!userinfo command?
I am trying to make my userinfo command where you can do it for any user and show voice hours in server and messages sent in server here is my !!userinfo command 我试图使我的userinfo命令可以在任何用户那里执行,并在服务器中显示语音时数,并且在服务器中发送的消息是我的!! userinfo命令
const Discord = module.require("discord.js");
module.exports.run = async (bot, message, args) => {
let member = message.mentions.members.first() || message.member,
user = member.user;
let embed = new Discord.RichEmbed()
.setAuthor(message.author.username)
.setDescription("Users Info")
.setColor("#9B59B6")
.addField("Full Username:", `${message.author.username}${message.author.discriminator}`)
.addField("ID:", message.author.id)
.addField("Created at:", message.author.createdAt)
.addField("Status:", `${user.presence.status}`)
.addField("Game:", `${user.presence.game}`)
.addField("Roles", member.roles.map(r => `${r}`).join('|'), true);
message.channel.send(embed);
}
module.exports.help = {
name: "userinfo"
}
How would I show voice hours and messages sent? 如何显示通话时间和发送的消息? Would I have to use SQL to record it?
我必须使用SQL进行记录吗?
You would need to record/save all of it yes, either with SQL or in some local JSON file. 您需要使用SQL或某些本地JSON文件来记录/保存所有这些内容。 For Voice hours you'd need to listen to the voiceStateUpdate event and save when a user joins and when a user leaves a voice channel.
对于语音小时,您需要收听voiceStateUpdate事件并保存用户加入和用户离开语音通道的时间。 Then you'd calculate the time inbetween those timeframes and add it to the total amount of voice hours for said user.
然后,您需要计算这些时间段之间的时间,并将其添加到该用户的总语音小时数中。
For messages you'd just need to listen to the message event and increment a counter for that specific user each time. 对于消息,您只需要侦听消息事件并每次为该特定用户增加一个计数器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.