simplified

This commit is contained in:
almeidx 2021-07-29 10:47:47 +01:00
parent e12f37bb6a
commit f4b4747d08
No known key found for this signature in database
GPG key ID: 8558FBFF849BD664
2 changed files with 3 additions and 9 deletions

View file

@ -103,7 +103,7 @@ export async function getUserInfoEmbed(
}); });
const roles = member.roles.cache const roles = member.roles.cache
.map(role => pluginData.guild.roles.cache.get(role.id)) .map(role => pluginData.guild.roles.cache.get(role.id))
.filter(r => r != null) as Role[]; .filter((r): r is Role => !!r);
roles.sort(sorter("position", "DESC")); roles.sort(sorter("position", "DESC"));
embed.fields.push({ embed.fields.push({
@ -119,7 +119,7 @@ export async function getUserInfoEmbed(
embed.fields.push({ embed.fields.push({
name: preEmbedPadding + "Voice information", name: preEmbedPadding + "Voice information",
value: trimLines(` value: trimLines(`
${voiceChannel ? `Current voice channel: **${voiceChannel ? voiceChannel.name : "None"}**` : ""} ${voiceChannel ? `Current voice channel: **${voiceChannel.name ?? "None"}**` : ""}
${member.voice.mute ? "Server voice muted: **Yes**" : ""} ${member.voice.mute ? "Server voice muted: **Yes**" : ""}
${member.voice.deaf ? "Server voice deafened: **Yes**" : ""} ${member.voice.deaf ? "Server voice deafened: **Yes**" : ""}
`), `),

View file

@ -177,17 +177,11 @@ export async function displaySearch(
.setEmoji("⬅") .setEmoji("⬅")
.setCustomId(`previousButton:${idMod}`) .setCustomId(`previousButton:${idMod}`)
.setDisabled(currentPage === 1), .setDisabled(currentPage === 1),
);
buttons.push(
new MessageButton() new MessageButton()
.setStyle("SECONDARY") .setStyle("SECONDARY")
.setEmoji("➡") .setEmoji("➡")
.setCustomId(`nextButton:${idMod}`) .setCustomId(`nextButton:${idMod}`)
.setDisabled(currentPage === searchResult.lastPage), .setDisabled(currentPage === searchResult.lastPage),
);
buttons.push(
new MessageButton() new MessageButton()
.setStyle("SECONDARY") .setStyle("SECONDARY")
.setEmoji("🔄") .setEmoji("🔄")
@ -325,7 +319,7 @@ async function performMemberSearch(
} }
if (args.voice) { if (args.voice) {
matchingMembers = matchingMembers.filter(m => m.voice.channelId != null); matchingMembers = matchingMembers.filter(m => m.voice.channelId);
} }
if (args.bot) { if (args.bot) {