Discord.js User Presence Customize(Discord.js 用户状态自定义)
问题描述
当我使用 discord bot 命令时,为了显示特定人员的不和谐状态,假设他的状态设置为请勿打扰",也就是 dnd.我想要这条线:**• Discord 用户名:** ${user.username},假设特定的人在线,我希望它用大写的O"说在线",但它显示为在线".或者dnd"也一样,我希望它是请勿打扰".我将用户定义为: message.mentions.users.first() ||消息作者有什么方法可以帮忙?
When I use a discord bot command, for the purpose of showing the specific person's discord presence, let's say his presence is set on 'Do Not Disturb' a.k.a dnd.
I want this line :
**• Discord Username:** ${user.username},
lets say that specific person is on online, I want it to say 'Online' with a capital 'O', but it shows it as 'online'. Or the same thing for 'dnd', i want it as 'Do Not Disturb'.
I've defined user as : message.mentions.users.first() || message.author
Any ways to help?
推荐答案
const Presence = {
"online": "Online",
"dnd": "Do Not Disturb",
"idle": "Idle",
"offline": "Offline"
}
client.on("message", message => {
if (message.author.bot) return false;
if (message.content.toLowerCase() == "-presence") {
const User = message.mentions.users.first() || message.author;
message.channel.send(Presence[User.presence.status]);
};
});
这篇关于Discord.js 用户状态自定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Discord.js 用户状态自定义
基础教程推荐
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
