Added new tryCatch wrapper

This commit is contained in:
2025-03-20 23:41:18 +01:00
parent e555417e13
commit 95f9bb723f
16 changed files with 255 additions and 269 deletions

View File

@@ -1,7 +1,8 @@
import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, User, userMention } from "discord.js"
import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
import { devMessage, embedColor } from "~/config/options"
import { ICommand } from "~/typings"
import logToChannel from "~/utils/Functions/logtochannel"
import tryCatch from "~/utils/Functions/trycatch"
export default {
name: "unban",
@@ -34,7 +35,6 @@ export default {
const userid = interaction.options.getString("user")!
const reason = interaction.options.getString("reason") || "No reason provided"
const mod = interaction.user
let user: User
if (userid === "none") {
await interaction.editReply({
@@ -46,10 +46,9 @@ export default {
return
}
try {
user = await interaction.client.users.fetch(userid)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (error) {
const [e, user] = await tryCatch(interaction.client.users.fetch(userid))
if (e) {
await interaction.editReply({
embeds: [{
description: "The user you specified is not valid",