From f2f3a9c6e48df8409191bbfbcadf1e23561ea7ff Mon Sep 17 00:00:00 2001 From: mouse_484 Date: Sat, 16 Mar 2019 04:35:12 +0000 Subject: [PATCH 1/2] =?UTF-8?q?userinfo=E5=88=9D=E6=9C=9F=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/bot/userinfo.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 commands/bot/userinfo.js diff --git a/commands/bot/userinfo.js b/commands/bot/userinfo.js new file mode 100644 index 0000000..63cd680 --- /dev/null +++ b/commands/bot/userinfo.js @@ -0,0 +1,16 @@ +const { Command } = require("discord.js-commando"); + +module.exports = class user_info extends Command { + constructor(client) { + super(client, { + name: "userinfo", + group: "bot", + memberName: "userinfo", + description: "ユーザーの情報を表示します", + }); + } + + run(message) { + + } +}; From 5b2164c39581f5abcc8b3ce12cf99302991f14aa Mon Sep 17 00:00:00 2001 From: mouse_484 Date: Sat, 16 Mar 2019 06:00:32 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E6=83=85=E5=A0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/bot/userinfo.js | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/commands/bot/userinfo.js b/commands/bot/userinfo.js index 63cd680..e713a29 100644 --- a/commands/bot/userinfo.js +++ b/commands/bot/userinfo.js @@ -4,13 +4,49 @@ module.exports = class user_info extends Command { constructor(client) { super(client, { name: "userinfo", + aliases: ["uinfo", "ユーザー情報"], group: "bot", memberName: "userinfo", description: "ユーザーの情報を表示します", + args: [ + { + key: "user", + type: "user", + prompt: "ユーザー名又はIDを入力してください", + default: "", + }, + ], }); } - run(message) { - + run(message, { user }) { + const user_info = (user_id) => { + const user = this.client.users.get(user_id); + return { + embed: { + author: { + icon_url: user.avatarURL, + name: `${user.username}の情報`, + }, + thumbnail: { url: user.avatarURL }, + fields: [ + { name: "ユーザー名", value: user.tag, inline: true }, + { name: "ID", value: user.id, inline: true }, + { name: "ステータス", value: user.presence.status, inline: true }, + { name: "Bot", value: user.bot ? "はい" : "いいえ", inline: true }, + ], + footer: { text: "作成日" }, + timestamp: user.createdAt, + color: 0xB8E986, + }, + }; + } + + + if (user) { + return message.say(user_info(user.id)); + } else { + return message.say(user_info(message.author.id)); + } } };