简体   繁体   English

如何在!! userinfo命令中显示服务器中的语音时数和服务器中发送的消息?

[英]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.

相关问题 如何在语音通道中记录时间并在!! userinfo命令中显示时间 - How would I record time in voice channel and display it in my !!userinfo command 如何获得每24小时在服务器上运行一次的功能? - How would I get a function to run every 24 hours on a server? 我如何将我的正常运行时间命令的格式更改为当前时间,我想将其更改为几天 - How do I change the format for my uptime command its currently hours I would like to change it to days 如何通过node.js服务器发送事件发送命令行输出并在浏览器中显示 - How can I send command line output through node.js server-sent-event and show it in browser 我试图在我的!! userinfo命令中显示角色,但出现错误 - I am trying to show roles in my !!userinfo command but I get errors 在我的 userinfo 命令中,我应该怎么做,我不必使用此人的 ID 并 ping 他们。 它将显示使用 cmd 的人的信息 - In my userinfo command how should i do that I don’t have to use the ID of the person and ping them. It will show the info of the person using the cmd 如何在我现有的 nodejs 服务器上使用 sqs 消息 - How can i consume sqs messages at my existing nodejs server jqgrid如何显示服务器端消息 - jqgrid how to show server side messages 如何显示用户 discord.js / userinfo 命令的角色 - How to show roles of user discord.js / userinfo command 如何安排任务在我的 tomcat 服务器上每 X 小时运行一次? - How can I schedule a task to run every X hours on my tomcat server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM