3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Reformat all files with Prettier

This commit is contained in:
Dragory 2021-09-11 19:06:51 +03:00
parent 0cde0d46d2
commit ac79eb09f5
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
206 changed files with 727 additions and 888 deletions

View file

@ -96,8 +96,8 @@ export async function getChannelInfoEmbed(
if (channel.type === ChannelTypeStrings.VOICE || channel.type === ChannelTypeStrings.STAGE) {
const voiceMembers = Array.from((channel as VoiceChannel | StageChannel).members.values());
const muted = voiceMembers.filter(vm => vm.voice.mute || vm.voice.selfMute);
const deafened = voiceMembers.filter(vm => vm.voice.deaf || vm.voice.selfDeaf);
const muted = voiceMembers.filter((vm) => vm.voice.mute || vm.voice.selfMute);
const deafened = voiceMembers.filter((vm) => vm.voice.deaf || vm.voice.selfDeaf);
const voiceOrStage = channel.type === ChannelTypeStrings.VOICE ? "Voice" : "Stage";
embed.fields.push({
@ -112,10 +112,10 @@ export async function getChannelInfoEmbed(
if (channel.type === ChannelTypeStrings.CATEGORY) {
const textChannels = pluginData.guild.channels.cache.filter(
ch => ch.parentId === channel.id && ch.type !== ChannelTypeStrings.VOICE,
(ch) => ch.parentId === channel.id && ch.type !== ChannelTypeStrings.VOICE,
);
const voiceChannels = pluginData.guild.channels.cache.filter(
ch =>
(ch) =>
ch.parentId === channel.id && (ch.type === ChannelTypeStrings.VOICE || ch.type === ChannelTypeStrings.STAGE),
);

View file

@ -7,7 +7,7 @@ export async function getEmojiInfoEmbed(
pluginData: GuildPluginData<UtilityPluginType>,
emojiId: string,
): Promise<MessageEmbedOptions | null> {
const emoji = pluginData.guild.emojis.cache.find(e => e.id === emojiId);
const emoji = pluginData.guild.emojis.cache.find((e) => e.id === emojiId);
if (!emoji) {
return null;
}

View file

@ -120,9 +120,7 @@ export async function getInviteInfoEmbed(
/*if (invite.channel.icon) {
embed.author.icon_url = `https://cdn.discordapp.com/channel-icons/${invite.channel.id}/${invite.channel.icon}.png?size=256`;
}*/ const channelCreatedAtTimestamp = snowflakeToTimestamp(
invite.channel.id,
);
}*/ const channelCreatedAtTimestamp = snowflakeToTimestamp(invite.channel.id);
const channelCreatedAt = moment.utc(channelCreatedAtTimestamp, "x");
const channelAge = humanizeDuration(Date.now() - channelCreatedAtTimestamp, {
largest: 2,

View file

@ -35,13 +35,13 @@ export async function getRoleInfoEmbed(
round: true,
});
const rolePerms = Object.keys(role.permissions.toJSON()).map(p =>
const rolePerms = Object.keys(role.permissions.toJSON()).map((p) =>
p
// Voice channel related permission names start with 'voice'
.replace(/^voice/i, "")
.replace(/([a-z])([A-Z])/g, "$1 $2")
.toLowerCase()
.replace(/(^\w{1})|(\s{1}\w{1})/g, l => l.toUpperCase()),
.replace(/(^\w{1})|(\s{1}\w{1})/g, (l) => l.toUpperCase()),
);
// -1 because of the @everyone role
@ -54,10 +54,7 @@ export async function getRoleInfoEmbed(
ID: \`${role.id}\`
Created: **${roleAge} ago** (\`${prettyCreatedAt}\`)
Position: **${role.position} / ${totalGuildRoles}**
Color: **#${role.color
.toString(16)
.toUpperCase()
.padStart(6, "0")}**
Color: **#${role.color.toString(16).toUpperCase().padStart(6, "0")}**
Mentionable: **${role.mentionable ? "Yes" : "No"}**
Hoisted: **${role.hoist ? "Yes" : "No"}**
Permissions: \`${rolePerms.length ? rolePerms.join(", ") : "None"}\`

View file

@ -134,7 +134,7 @@ export async function getServerInfoEmbed(
}
if (!onlineMemberCount && thisServer) {
onlineMemberCount = thisServer.members.cache.filter(m => m.presence?.status !== "offline").size; // Extremely inaccurate fallback
onlineMemberCount = thisServer.members.cache.filter((m) => m.presence?.status !== "offline").size; // Extremely inaccurate fallback
}
const offlineMemberCount = totalMembers - onlineMemberCount;
@ -162,9 +162,9 @@ export async function getServerInfoEmbed(
// CHANNEL COUNTS
if (thisServer) {
const totalChannels = thisServer.channels.cache.size;
const categories = thisServer.channels.cache.filter(channel => channel.type === ChannelTypeStrings.CATEGORY);
const textChannels = thisServer.channels.cache.filter(channel => channel.type === ChannelTypeStrings.TEXT);
const voiceChannels = thisServer.channels.cache.filter(channel => channel.type === ChannelTypeStrings.VOICE);
const categories = thisServer.channels.cache.filter((channel) => channel.type === ChannelTypeStrings.CATEGORY);
const textChannels = thisServer.channels.cache.filter((channel) => channel.type === ChannelTypeStrings.TEXT);
const voiceChannels = thisServer.channels.cache.filter((channel) => channel.type === ChannelTypeStrings.VOICE);
embed.fields.push({
name: preEmbedPadding + "Channels",

View file

@ -102,14 +102,14 @@ export async function getUserInfoEmbed(
largest: 2,
round: true,
});
const roles = Array.from(member.roles.cache.values()).filter(r => r.id !== pluginData.guild.id);
const roles = Array.from(member.roles.cache.values()).filter((r) => r.id !== pluginData.guild.id);
roles.sort(sorter("position", "DESC"));
embed.fields.push({
name: preEmbedPadding + "Member information",
value: trimLines(`
${user.bot ? "Added" : "Joined"}: **${joinAge} ago** (\`${prettyJoinedAt}\`)
${roles.length > 0 ? "Roles: " + roles.map(r => `<@&${r.id}>`).join(", ") : ""}
${roles.length > 0 ? "Roles: " + roles.map((r) => `<@&${r.id}>`).join(", ") : ""}
`),
});
@ -130,14 +130,14 @@ export async function getUserInfoEmbed(
value: `${user.bot ? "Bot" : "User"} is not on the server`,
});
}
const cases = (await pluginData.state.cases.getByUserId(user.id)).filter(c => !c.is_hidden);
const cases = (await pluginData.state.cases.getByUserId(user.id)).filter((c) => !c.is_hidden);
if (cases.length > 0) {
cases.sort((a, b) => {
return a.created_at < b.created_at ? 1 : -1;
});
const caseSummary = cases.slice(0, 3).map(c => {
const caseSummary = cases.slice(0, 3).map((c) => {
const summaryText = `${CaseTypes[c.type]} (#${c.case_number})`;
if (c.log_message_id) {