Fixed formatting on all command files

This commit is contained in:
2024-01-20 17:19:08 +01:00
parent f34923e2c5
commit a3791d170c
25 changed files with 655 additions and 1168 deletions

View File

@@ -1,10 +1,4 @@
import {
SlashCommandBuilder,
PermissionFlagsBits,
userMention,
ChatInputCommandInteraction,
GuildMember
} from "discord.js"
import { SlashCommandBuilder, PermissionFlagsBits, userMention, ChatInputCommandInteraction, GuildMember } from "discord.js"
import { color, devMessage } from "config/options.json"
import { Command } from "interfaces"
import ms from "ms"
@@ -44,8 +38,7 @@ export = {
const target = interaction.options.getMember("user")! as GuildMember
const timeString = interaction.options.getString("time")!
const reason =
interaction.options.getString("reason") || "No reason provided"
const reason = interaction.options.getString("reason") || "No reason provided"
const mod = interaction.member! as GuildMember
const embedColor = Number(color.replace("#", "0x"))
const time = ms(timeString)
@@ -54,65 +47,50 @@ export = {
if (target.user.bot) {
interaction.editReply({
embeds: [
{
description: "You cannot timeout a bot.",
color: embedColor
}
]
embeds: [{
description: "You cannot timeout a bot.",
color: embedColor
}]
})
return
}
if (target.id == interaction.guild!.ownerId) {
await interaction.editReply({
embeds: [
{
description: "You cannot timeout the server owner.",
color: embedColor
}
]
embeds: [{
description: "You cannot timeout the server owner.",
color: embedColor
}]
})
return
}
if (
interaction.guild!.members.me!.roles.highest.position <=
target.roles.highest.position
) {
if (interaction.guild!.members.me!.roles.highest.position <= target.roles.highest.position) {
interaction.editReply({
embeds: [
{
description:
"I cannot timeout this user because their role is higher than mine.",
color: embedColor
}
]
embeds: [{
description: "I cannot timeout this user because their role is higher than mine.",
color: embedColor
}]
})
return
}
if (mod.roles.highest.position <= target.roles.highest.position) {
await interaction.editReply({
embeds: [
{
description:
"You cannot timeout this user because their role is higher than yours.",
color: embedColor
}
]
embeds: [{
description: "You cannot timeout this user because their role is higher than yours.",
color: embedColor
}]
})
return
}
if (target.id == interaction.user.id) {
interaction.editReply({
embeds: [
{
description: "You cannot timeout yourself.",
color: embedColor
}
]
embeds: [{
description: "You cannot timeout yourself.",
color: embedColor
}]
})
return
}
@@ -123,75 +101,55 @@ export = {
if (target.isCommunicationDisabled()) {
if (time === 0) {
title = "Timeout Removed"
description =
"Removed timeout of " +
userMention(target.id) +
" for " +
reason
description = "Removed timeout of " + userMention(target.id) + " for " + reason
timeouttime = null
} else {
title = "Timeout Updated"
description =
"Updated timeout of " +
userMention(target.id) +
" to " +
prettyTime +
" for " +
reason
description = "Updated timeout of " + userMention(target.id) + " to " + prettyTime + " for " + reason
timeouttime = time
}
} else {
title = "Member Timed Out"
description =
"Timed out " +
userMention(target.id) +
" for " +
prettyTime +
" for " +
reason
description = "Timed out " + userMention(target.id) + " for " + prettyTime + " for " + reason
timeouttime = time
}
await target.timeout(timeouttime, reason)
await logToChannel("mod", {
embeds: [
{
author: {
name: mod.user.username,
icon_url: mod.user.avatarURL() || undefined
},
title: title,
description: `
embeds: [{
author: {
name: mod.user.username,
icon_url: mod.user.avatarURL() || undefined
},
title: title,
description: `
**User:** ${userMention(target.id)}
${timeouttime === null ? "**Time:** `None`" : "**Time:** `" + prettyTime + "`"}
**Reason:** \`${reason}\`
**Mod:** ${userMention(mod.id)}
`,
color: embedColor,
thumbnail: {
url: mod.user.avatarURL() || ""
},
footer: {
text: "ID: " + target.id,
icon_url: target.user.avatarURL() || undefined
},
timestamp: new Date().toISOString()
}
]
color: embedColor,
thumbnail: {
url: mod.user.avatarURL() || ""
},
footer: {
text: "ID: " + target.id,
icon_url: target.user.avatarURL() || undefined
},
timestamp: new Date().toISOString()
}]
})
await interaction.editReply({
embeds: [
{
description: description,
color: embedColor,
footer: {
text: interaction.guild!.name + " | " + devMessage,
icon_url: interaction.guild!.iconURL() || undefined
}
embeds: [{
description: description,
color: embedColor,
footer: {
text: interaction.guild!.name + " | " + devMessage,
icon_url: interaction.guild!.iconURL() || undefined
}
]
}]
})
}
} as Command