【发布时间】:2020-09-26 19:58:01
【问题描述】:
我想知道是否有可能让成员使用不和谐的设备(Web、桌面、移动应用程序)将其放入 userinfo 命令中。
感谢您的建议。
【问题讨论】:
-
暂时不可以。
-
如果有可能你需要做很多
API Requests
标签: javascript node.js bots discord discord.js
我想知道是否有可能让成员使用不和谐的设备(Web、桌面、移动应用程序)将其放入 userinfo 命令中。
感谢您的建议。
【问题讨论】:
API Requests
标签: javascript node.js bots discord discord.js
实际上,您可以使用公会的存在。确保read the docs。
【讨论】:
.clientStatus
是的
client.on("消息", 异步消息 => { if (message.content.toLowerCase().startsWith('-device')){
const user = message.mentions.users.first();
let devices = [];
if (!user) {
var status = message.author.presence.clientStatus;
} else {
var status = user.presence.clientStatus;
if (user.bot) {
const webbot = new Discord.MessageEmbed()
.setTitle(`${user.tag} device:`)
.setDescription("web")
message.channel.send(webbot)
return;
};
};
if (!status) {
// status is unavailable
const nostatus = new Discord.MessageEmbed()
.setTitle(`${user.tag} device:`)
.setDescription("unavaliable")
message.channel.send(nostatus)
return;
};
if (status.desktop) {
devices.push('desktop');
};
if (status.web) {
devices.push('web');
};
if (status.mobile) {
devices.push('mobile');
};
devices = devices.join(', ') || 'None';
const dev = new Discord.MessageEmbed()
.setTitle(`${user.tag} device:`)
.setDescription(devices)
message.channel.send(dev)
// send message
} })
【讨论】:
const Discord = require("discord.js");
let member = message.mentions.members.first();
function getDevice(GuildMember = Discord.GuildMember.prototype) {
let userS = GuildMember.presence.clientStatus;
if (userS) {
if (GuildMember.user.bot) {
return "Web";
} else if (userS.desktop) {
return "Computer";
} else if (userS.mobile) {
return "Mobile";
} else if (userS.web) {
return "Web";
} else { return "unknown"; }
} else { return "unknown" };
} console.log(`User device is ${getDevice(member)}`);
【讨论】: