Skip to content

Commit

Permalink
Merge pull request #6 from Escgroup/command/userinfo
Browse files Browse the repository at this point in the history
ユーザー情報
  • Loading branch information
mouse484 authored Mar 16, 2019
2 parents bbcc11a + 5b2164c commit 13e8430
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions commands/bot/userinfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const { Command } = require("discord.js-commando");

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, { 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));
}
}
};

0 comments on commit 13e8430

Please sign in to comment.