Added new tryCatch wrapper
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user