1 |
|
/** |
2 |
|
* This file is part of SudoBot. |
3 |
|
* |
4 |
|
* Copyright (C) 2021-2022 OSN Inc. |
5 |
|
* |
6 |
|
* SudoBot is free software; you can redistribute it and/or modify it |
7 |
|
* under the terms of the GNU Affero General Public License as published by |
8 |
|
* the Free Software Foundation, either version 3 of the License, or |
9 |
|
* (at your option) any later version. |
10 |
|
* |
11 |
|
* SudoBot is distributed in the hope that it will be useful, but |
12 |
|
* WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
* GNU Affero General Public License for more details. |
15 |
|
* |
16 |
|
* You should have received a copy of the GNU Affero General Public License |
17 |
|
* along with SudoBot. If not, see <https://www.gnu.org/licenses/>. |
18 |
|
*/ |
19 |
|
|
20 |
import { formatDistanceStrict, formatDistanceToNowStrict } from "date-fns"; |
import { formatDistanceStrict, formatDistanceToNowStrict } from "date-fns"; |
21 |
import { APIEmbedField } from "discord-api-types/v9"; |
import { APIEmbedField } from "discord-api-types/v9"; |
22 |
import { Util, Message, Interaction, CacheType, CommandInteraction } from "discord.js"; |
import { Util, Message, CacheType, CommandInteraction } from "discord.js"; |
23 |
import Client from "../../client/Client"; |
import Client from "../../client/Client"; |
24 |
import MessageEmbed from "../../client/MessageEmbed"; |
import MessageEmbed from "../../client/MessageEmbed"; |
25 |
import CommandOptions from "../../types/CommandOptions"; |
import CommandOptions from "../../types/CommandOptions"; |
26 |
import InteractionOptions from "../../types/InteractionOptions"; |
import InteractionOptions from "../../types/InteractionOptions"; |
27 |
import { emoji } from "../../utils/Emoji"; |
import { emoji } from "../../utils/Emoji"; |
28 |
import getUser from "../../utils/getUser"; |
import getUser from "../../utils/getUser"; |
|
import { parseUser } from "../../utils/parseInput"; |
|
29 |
import BaseCommand from "../../utils/structures/BaseCommand"; |
import BaseCommand from "../../utils/structures/BaseCommand"; |
30 |
|
import { getUserBadges } from "./ProfileCommand"; |
31 |
|
|
32 |
export default class UserLookupCommand extends BaseCommand { |
export default class UserLookupCommand extends BaseCommand { |
33 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
99 |
} |
} |
100 |
]; |
]; |
101 |
|
|
102 |
|
embed.setThumbnail(user.displayAvatarURL()); |
103 |
|
|
104 |
if (member) { |
if (member) { |
105 |
fields.push({ |
fields.push({ |
106 |
name: "Joined Server", |
name: "Joined Server", |
171 |
} |
} |
172 |
} |
} |
173 |
|
|
174 |
|
const badges = getUserBadges(user).join('\n'); |
175 |
|
|
176 |
|
fields.push({ |
177 |
|
name: "Badges", |
178 |
|
value: badges.trim() === '' ? '*No badges found*' : badges |
179 |
|
}); |
180 |
|
|
181 |
fields = [...fields, ...fieldsCommon]; |
fields = [...fields, ...fieldsCommon]; |
182 |
embed.setFields(fields); |
embed.setFields(fields); |
183 |
embed.setTimestamp(); |
embed.setTimestamp(); |