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 { CommandInteraction, GuildMember, Message, User, UserFlags } from 'discord.js'; |
import { CommandInteraction, GuildMember, Message, User, UserFlags } from 'discord.js'; |
21 |
import BaseCommand from '../../utils/structures/BaseCommand'; |
import BaseCommand from '../../utils/structures/BaseCommand'; |
22 |
import DiscordClient from '../../client/Client'; |
import DiscordClient from '../../client/Client'; |
133 |
} |
} |
134 |
else if (a.type === 'LISTENING') { |
else if (a.type === 'LISTENING') { |
135 |
if (a.name === 'Spotify') { |
if (a.name === 'Spotify') { |
136 |
activities.push(`:notes: Listening to **Spotify**: **${a.state?.replace(/\;/, ',')} - ${a.details}**`); |
const url = a.syncId ? `https://open.spotify.com/track/${a.syncId}` : null; |
137 |
|
activities.push(`:notes: Listening to **Spotify**: ${url ? '[' : '**'}${a.state?.replace(/\;/, ',')} - ${a.details}${url ? '](' + url + ')' : '**'}`); |
138 |
continue; |
continue; |
139 |
} |
} |
140 |
|
|
157 |
|
|
158 |
activities = activities.join('\n'); |
activities = activities.join('\n'); |
159 |
|
|
160 |
|
const allRoles = [...user!.roles.cache.values()].filter(role => role.id !== msg.guild!.id).sort((role1, role2) => { |
161 |
|
return role2.position - role1.position; |
162 |
|
}); |
163 |
|
const limit = 10; |
164 |
|
const roles = (allRoles.length > limit ? allRoles.slice(0, limit) : allRoles).reduce((acc, value) => `${acc} ${roleMention(value.id)}`, '')!.trim()!; |
165 |
const fields = [ |
const fields = [ |
166 |
{ |
{ |
167 |
name: "Nickname", |
name: "Nickname", |
185 |
}, |
}, |
186 |
{ |
{ |
187 |
name: 'Roles', |
name: 'Roles', |
188 |
value: user?.roles.cache.filter(role => role.id !== msg.guild!.id).sort((role1, role2) => { |
value: roles === '' ? '*No roles assigned*' : `${roles} ${allRoles.length > limit ? `**+ ${allRoles.length - limit} More**` : ''}` |
|
return role2.position - role1.position; |
|
|
}).reduce((acc, value) => `${acc} ${roleMention(value.id)}`, '')!.trim()! |
|
189 |
} |
} |
190 |
]; |
]; |
191 |
|
|
198 |
}); |
}); |
199 |
} |
} |
200 |
|
|
201 |
|
let banner: string | undefined; |
202 |
|
|
203 |
|
try { |
204 |
|
await user?.user.fetch(true); |
205 |
|
banner = user!.user!.bannerURL({ size: 4096 }) ?? undefined; |
206 |
|
} |
207 |
|
catch (e) { |
208 |
|
console.log(e); |
209 |
|
} |
210 |
|
|
211 |
|
console.log("Banner", banner, user!.user!.banner); |
212 |
|
|
213 |
await msg.reply({ |
await msg.reply({ |
214 |
embeds: [ |
embeds: [ |
215 |
new MessageEmbed() |
new MessageEmbed({ |
216 |
|
image: { |
217 |
|
url: banner, |
218 |
|
} |
219 |
|
}) |
220 |
.setColor(user!.user!.hexAccentColor ? user!.user!.hexAccentColor! : '#007bff') |
.setColor(user!.user!.hexAccentColor ? user!.user!.hexAccentColor! : '#007bff') |
221 |
.setAuthor({ |
.setAuthor({ |
222 |
name: user?.user.tag!, |
name: user?.user.tag!, |
227 |
})) |
})) |
228 |
.setFields(fields) |
.setFields(fields) |
229 |
.setFooter({ |
.setFooter({ |
230 |
text: `${user!.id} - ${user?.user.bot ? 'Bot' : 'User'}` |
text: `${user?.user.bot ? 'Bot' : 'User'} • ${user!.id}` |
231 |
}) |
}) |
232 |
] |
] |
233 |
}); |
}); |