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 用户状态自定义


基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01