Merge pull request #202 from VermiumSifell/201-fix-code-smells

Fixed code smells
This commit is contained in:
Axel Olausson Holtenäs 2022-04-10 22:22:19 +02:00 committed by GitHub
commit 240ecf025f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 153 additions and 168 deletions

View file

@ -16,13 +16,13 @@ export default async (interaction: CommandInteraction) => {
// Module - Add
if (options?.getSubcommand() === "add") {
// Execute Module - Add
return await add(interaction);
return add(interaction);
}
// Module - Remove
else if (options?.getSubcommand() === "remove") {
// Execute Module - Remove
return await remove(interaction);
return remove(interaction);
}
// Log debug message

View file

@ -25,12 +25,11 @@ export default async (interaction: CommandInteraction) => {
const optionStart = options?.getNumber("start");
if (optionChannel?.type !== "GUILD_TEXT") {
// Embed object
const embed = {
title: ":toolbox: Admin - Counters [Add]" as string,
description:
"That channel is not supported, it needs to be a text channel." as string,
timestamp: new Date() as Date,
timestamp: new Date(),
color: config?.colors?.error as ColorResolvable,
footer: {
iconURL: config?.footer?.icon as string,
@ -39,7 +38,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
const counterExist = await counterSchema?.findOne({
@ -56,14 +55,12 @@ export default async (interaction: CommandInteraction) => {
counter: optionStart || 0,
});
// Embed object
const embed = {
title: ":toolbox: Admin - Counters [Add]" as string,
description:
`${optionChannel} is now counting when hearing word ${optionWord} and it starts at number ${
optionStart || 0
}.` as string,
timestamp: new Date() as Date,
description: `${optionChannel} is now counting when hearing word ${optionWord} and it starts at number ${
optionStart || 0
}.`,
timestamp: new Date(),
color: config?.colors?.success as ColorResolvable,
footer: {
iconURL: config?.footer?.icon as string,
@ -83,8 +80,8 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Counters [Add]" as string,
description: `${optionChannel} is already a counting channel.` as string,
timestamp: new Date() as Date,
description: `${optionChannel} is already a counting channel.`,
timestamp: new Date(),
color: config?.colors?.error as ColorResolvable,
footer: {
iconURL: config?.footer?.icon as string,

View file

@ -27,9 +27,8 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Counters [Remove]" as string,
description:
`${optionChannel} is no longer an counting channel.` as string,
timestamp: new Date() as Date,
description: `${optionChannel} is no longer an counting channel.`,
timestamp: new Date(),
color: config?.colors?.success as ColorResolvable,
footer: {
iconURL: config?.footer?.icon as string,

View file

@ -10,29 +10,29 @@ import transfer from "./modules/transfer";
// Function
export default async (interaction: CommandInteraction) => {
// Destructure
const { user, guild, commandName, options } = interaction;
const { options } = interaction;
// Module - Give
if (options?.getSubcommand() === "give") {
// Execute Module - Give
return await give(interaction);
return give(interaction);
}
// Module - Take
else if (options?.getSubcommand() === "take") {
// Execute Module - Take
return await take(interaction);
return take(interaction);
}
// Module - Set
else if (options?.getSubcommand() === "set") {
// Execute Module - Set
return await set(interaction);
return set(interaction);
}
// Module - Transfer
else if (options?.getSubcommand() === "transfer") {
// Execute Module - Transfer
return await transfer(interaction);
return transfer(interaction);
}
};

View file

@ -31,7 +31,7 @@ export default async (interaction: CommandInteraction) => {
title: ":toolbox: Admin - Credits [Give]" as string,
description: "We could not read your requested amount." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -39,7 +39,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If amount is zero or below
@ -49,7 +49,7 @@ export default async (interaction: CommandInteraction) => {
title: ":toolbox: Admin - Credits [Give]" as string,
description: "You can not give zero credits or below." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -57,7 +57,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
if (optionUser === null) return;
@ -71,9 +71,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Give]" as string,
description: `We could not find ${optionUser} in our database.` as string,
description: `We could not find ${optionUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -81,7 +81,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If toUser.credits does not exist
@ -89,10 +89,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Give]" as string,
description:
`We could not find credits for ${optionUser} in our database.` as string,
description: `We could not find credits for ${optionUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -100,7 +99,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// Deposit amount to toUser
@ -111,11 +110,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Give]" as string,
description: `We have given ${optionUser}, ${creditNoun(
optionAmount
)}.` as string,
description: `We have given ${optionUser}, ${creditNoun(optionAmount)}.`,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -130,6 +127,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
};

View file

@ -1,5 +1,5 @@
// Dependencies
import { Permissions, CommandInteraction, ColorResolvable } from "discord.js";
import { CommandInteraction, ColorResolvable } from "discord.js";
// Configurations
import config from "../../../../../config.json";
@ -31,7 +31,7 @@ export default async (interaction: CommandInteraction) => {
title: ":toolbox: Admin - Credits [Set]" as string,
description: "We could not read your requested amount." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -39,7 +39,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
if (optionUser === null) return;
@ -53,9 +53,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Set]" as string,
description: `We could not find ${optionUser} in our database.` as string,
description: `We could not find ${optionUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -63,7 +63,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If toUser.credits does not exist
@ -71,10 +71,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Set]" as string,
description:
`We could not find credits for ${optionUser} in our database.` as string,
description: `We could not find credits for ${optionUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -82,7 +81,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// Set toUser with amount
@ -93,11 +92,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Set]" as string,
description: `We have set ${optionUser} to ${creditNoun(
optionAmount
)}` as string,
description: `We have set ${optionUser} to ${creditNoun(optionAmount)}`,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -112,6 +109,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
};

View file

@ -1,5 +1,5 @@
// Dependencies
import { Permissions, CommandInteraction, ColorResolvable } from "discord.js";
import { CommandInteraction, ColorResolvable } from "discord.js";
// Configurations
import config from "../../../../../config.json";
@ -31,7 +31,7 @@ export default async (interaction: CommandInteraction) => {
title: ":toolbox: Admin - Credits [Take]" as string,
description: "We could not read your requested amount." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -39,7 +39,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If amount is zero or below
@ -49,7 +49,7 @@ export default async (interaction: CommandInteraction) => {
title: ":toolbox: Admin - Credits [Take]" as string,
description: "You can not take zero credits or below." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -57,7 +57,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
if (optionUser === null) return;
@ -71,9 +71,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Take]" as string,
description: `We could not find ${optionUser} in our database.` as string,
description: `We could not find ${optionUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -81,7 +81,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If toUser.credits does not exist
@ -89,10 +89,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Take]" as string,
description:
`We could not find credits for ${optionUser} in our database.` as string,
description: `We could not find credits for ${optionUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -100,7 +99,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// Withdraw amount from toUser
@ -113,9 +112,9 @@ export default async (interaction: CommandInteraction) => {
title: ":toolbox: Admin - Credits [Set]" as string,
description: `We have taken ${creditNoun(
optionAmount
)} from ${optionUser}` as string,
)} from ${optionUser}`,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -130,6 +129,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
};

View file

@ -31,7 +31,7 @@ export default async (interaction: CommandInteraction) => {
title: ":toolbox: Admin - Credits [Transfer]" as string,
description: "We could not read your requested amount." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -39,7 +39,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
if (guild === null) return;
@ -57,10 +57,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Transfer]" as string,
description:
`We could not find ${optionFromUser} in our database.` as string,
description: `We could not find ${optionFromUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -68,7 +67,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If toUser.credits does not exist
@ -76,10 +75,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Transfer]" as string,
description:
`We could not find credits for ${optionFromUser} in our database.` as string,
description: `We could not find credits for ${optionFromUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -87,7 +85,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If toUser does not exist
@ -95,10 +93,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Transfer]" as string,
description:
`We could not find ${optionToUser} in our database.` as string,
description: `We could not find ${optionToUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -106,7 +103,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If toUser.credits does not exist
@ -114,10 +111,9 @@ export default async (interaction: CommandInteraction) => {
// Embed object
const embed = {
title: ":toolbox: Admin - Credits [Transfer]" as string,
description:
`We could not find credits for ${optionToUser} in our database.` as string,
description: `We could not find credits for ${optionToUser} in our database.`,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -125,7 +121,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// Withdraw amount from fromUser
@ -141,7 +137,7 @@ export default async (interaction: CommandInteraction) => {
title: ":toolbox: Admin - Credits [Transfer]" as string,
description: `You sent ${creditNoun(
optionAmount
)} from ${optionFromUser} to ${optionToUser}.` as string,
)} from ${optionFromUser} to ${optionToUser}.`,
color: config?.colors?.success as ColorResolvable,
fields: [
{
@ -155,7 +151,7 @@ export default async (interaction: CommandInteraction) => {
inline: true,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -170,6 +166,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
};

View file

@ -144,7 +144,7 @@ export default {
title: ":toolbox: Admin" as string,
color: config?.colors?.error as ColorResolvable,
description: "You do not have permission to manage this!" as string,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -158,13 +158,13 @@ export default {
// Group - Credits
if (options?.getSubcommandGroup() === "credits") {
// Execute Group - Credits
return await credits(interaction);
return credits(interaction);
}
// Group - Counters
else if (options?.getSubcommandGroup() === "counters") {
// Execute Group - Counters
return await counters(interaction);
return counters(interaction);
}
// Send debug message

View file

@ -30,7 +30,7 @@ export default {
// Module - View
if (options?.getSubcommand() === "view") {
// Execute Module - View
return await view(interaction);
return view(interaction);
}
// Send debug message

View file

@ -25,7 +25,7 @@ export default async (interaction: CommandInteraction) => {
const embed = {
title: ":1234: Counters [View]" as string,
description: `${optionChannel} is not a counting channel.` as string,
timestamp: new Date() as Date,
timestamp: new Date(),
color: config?.colors?.error as ColorResolvable,
footer: {
iconURL: config?.footer?.icon as string,
@ -34,7 +34,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// Embed object
@ -42,7 +42,7 @@ export default async (interaction: CommandInteraction) => {
title: ":1234: Counters [View]" as string,
color: config.colors.success as ColorResolvable,
description: `${optionChannel} is currently at number ${counter?.counter}.`,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -50,5 +50,5 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
};

View file

@ -59,25 +59,25 @@ export default {
// Module - Balance
if (options?.getSubcommand() === "balance") {
// Execute Module - Balance
return await balance(interaction);
return balance(interaction);
}
// Module - Gift
else if (options?.getSubcommand() === "gift") {
// Execute Module - Gift
return await gift(interaction);
return gift(interaction);
}
// Module - Top
else if (options?.getSubcommand() === "top") {
// Execute Module - Top
return await top(interaction);
return top(interaction);
}
// Module - Work
else if (options?.getSubcommand() === "work") {
// Execute Module - Work
return await work(interaction);
return work(interaction);
}
// Send debug message

View file

@ -32,7 +32,7 @@ export default async (interaction: CommandInteraction) => {
optionUser || "you"
} in our database.` as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -52,7 +52,7 @@ export default async (interaction: CommandInteraction) => {
optionUser || "you"
} in our database.` as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -69,7 +69,7 @@ export default async (interaction: CommandInteraction) => {
optionUser ? `${optionUser} has` : "You have"
} ${creditNoun(userDB.credits)}.` as string,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,

View file

@ -47,7 +47,7 @@ export default async (interaction: CommandInteraction) => {
title: ":dollar: Credits [Gift]" as string,
description: "You can't pay yourself." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -55,7 +55,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If amount is null
@ -65,7 +65,7 @@ export default async (interaction: CommandInteraction) => {
title: ":dollar: Credits [Gift]" as string,
description: "We could not read your requested amount." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -73,7 +73,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If amount is zero or below
@ -83,7 +83,7 @@ export default async (interaction: CommandInteraction) => {
title: ":dollar: Credits [Gift]" as string,
description: "You can't pay zero or below." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -91,7 +91,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If user has below gifting amount
@ -102,7 +102,7 @@ export default async (interaction: CommandInteraction) => {
description:
`You have insufficient credits. Your credits is ${fromUserDB?.credits}` as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -110,7 +110,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If toUserDB has no credits
@ -121,7 +121,7 @@ export default async (interaction: CommandInteraction) => {
description:
`That user has no credits, I can not gift credits to ${optionUser}` as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -129,7 +129,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// Withdraw amount from fromUserDB
@ -147,7 +147,7 @@ export default async (interaction: CommandInteraction) => {
optionReason ? ` with reason: ${optionReason}` : ""
}. Your new credits is ${creditNoun(fromUserDB?.credits)}.`,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -161,7 +161,7 @@ export default async (interaction: CommandInteraction) => {
optionReason ? ` with reason: ${optionReason}` : ""
}. Your new credits is ${creditNoun(toUserDB?.credits)}.` as string,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -180,7 +180,7 @@ export default async (interaction: CommandInteraction) => {
);
// Send interaction reply
return await interaction.editReply({
return interaction.editReply({
embeds: [interactionEmbed],
});
});

View file

@ -35,7 +35,7 @@ export default async (interaction: CommandInteraction) => {
?.map((x, index) => entry(x, index))
?.join("\n")}` as string,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -43,5 +43,5 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
};

View file

@ -57,7 +57,7 @@ export default async (interaction: CommandInteraction) => {
title: ":dollar: Credits [Work]" as string,
description: `You have earned ${creditNoun(creditsEarned)}` as string,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -65,7 +65,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
// Create a timeout for the user
@ -97,7 +97,7 @@ export default async (interaction: CommandInteraction) => {
description: `You have worked within the last ${
guildDB?.credits?.workTimeout / 1000
} seconds, you can not work now!` as string,
timestamp: new Date() as Date,
timestamp: new Date(),
color: config?.colors?.error as ColorResolvable,
footer: {
iconURL: config?.footer?.icon as string,
@ -111,6 +111,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
};

View file

@ -30,7 +30,7 @@ export default {
// Module - View
if (options?.getSubcommand() === "view") {
// Execute Module - View
return await view(interaction);
return view(interaction);
}
// Send debug message

View file

@ -59,7 +59,7 @@ export default async (interaction: CommandInteraction) => {
inline: true,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -67,5 +67,5 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
};

View file

@ -44,7 +44,7 @@ export default async (interaction: CommandInteraction) => {
const embed = {
title: ":loudspeaker: Reputation [Give]" as string,
description: "You can not repute yourself." as string,
timestamp: new Date() as Date,
timestamp: new Date(),
color: config?.colors?.error as ColorResolvable,
footer: {
iconURL: config?.footer?.icon as string,
@ -53,7 +53,7 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// If type is positive
@ -73,7 +73,7 @@ export default async (interaction: CommandInteraction) => {
title: ":loudspeaker: Reputation [Give]" as string,
description:
`You have given ${optionTarget} a ${optionType} reputation!` as string,
timestamp: new Date() as Date,
timestamp: new Date(),
color: config?.colors?.success as ColorResolvable,
footer: {
iconURL: config?.footer?.icon as string,
@ -93,7 +93,7 @@ export default async (interaction: CommandInteraction) => {
timeoutId: "2022-04-10-16-42",
});
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
setTimeout(async () => {
@ -118,7 +118,7 @@ export default async (interaction: CommandInteraction) => {
description: `You have given reputation within the last ${
config?.reputation?.timeout / 1000
} seconds, you can not repute now!` as string,
timestamp: new Date() as Date,
timestamp: new Date(),
color: config.colors.error as ColorResolvable,
footer: {
iconURL: config?.footer?.icon as string,
@ -134,6 +134,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
};

View file

@ -79,7 +79,7 @@ export default async (interaction: CommandInteraction) => {
inline: true,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -92,6 +92,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
};

View file

@ -63,7 +63,7 @@ export default async (interaction: CommandInteraction) => {
inline: true,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -76,6 +76,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
};

View file

@ -32,7 +32,7 @@ export default async (interaction: CommandInteraction) => {
title: ":hammer: Settings - Guild [Pterodactyl]" as string,
color: config?.colors?.success as ColorResolvable,
description: "Pterodactyl settings is saved!" as string,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -45,6 +45,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
};

View file

@ -24,7 +24,7 @@ export default async (interaction: CommandInteraction) => {
title: ":tools: Settings - Guild" as string,
color: config?.colors?.error as ColorResolvable,
description: "You do not have permission to manage this!" as string,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -32,25 +32,25 @@ export default async (interaction: CommandInteraction) => {
};
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
// Module - Pterodactyl
if (options?.getSubcommand() === "pterodactyl") {
// Execute Module - Pterodactyl
return await pterodactyl(interaction);
return pterodactyl(interaction);
}
// Module - Credits
else if (options?.getSubcommand() === "credits") {
// Execute Module - Credits
return await credits(interaction);
return credits(interaction);
}
// Module - Points
else if (options?.getSubcommand() === "points") {
// Execute Module - Points
return await points(interaction);
return points(interaction);
}
// Send debug message

View file

@ -42,7 +42,7 @@ export default async (interaction: CommandInteraction) => {
inline: true,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -55,6 +55,6 @@ export default async (interaction: CommandInteraction) => {
);
// Return interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
});
};

View file

@ -58,13 +58,13 @@ export default {
// Module - Pterodactyl
if (options?.getSubcommand() === "pterodactyl") {
// Execute Module - Pterodactyl
return await pterodactyl(interaction);
return pterodactyl(interaction);
}
// Group - Roles
else if (options?.getSubcommandGroup() === "roles") {
// Execute Group - Roles
return await roles(interaction);
return roles(interaction);
}
// Send debug message

View file

@ -30,7 +30,7 @@ export default async (interaction: CommandInteraction) => {
title: ":dollar: Credits [Gift]" as string,
description: "We could not read your requested amount." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -38,7 +38,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
if (guild === null) return;
@ -64,7 +64,7 @@ export default async (interaction: CommandInteraction) => {
value: `${creditNoun(userDB?.credits)}` as string,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -86,7 +86,7 @@ export default async (interaction: CommandInteraction) => {
value: `${creditNoun(userDB?.credits)}` as string,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -107,7 +107,7 @@ export default async (interaction: CommandInteraction) => {
value: `${creditNoun(userDB?.credits)}` as string,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -159,7 +159,7 @@ export default async (interaction: CommandInteraction) => {
},
],
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -171,7 +171,7 @@ export default async (interaction: CommandInteraction) => {
title: ":shopping_cart: Shop [Pterodactyl]" as string,
description: "I have sent you the code in DM!" as string,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -208,7 +208,7 @@ export default async (interaction: CommandInteraction) => {
description:
"Something went wrong, please try again later." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -225,7 +225,7 @@ export default async (interaction: CommandInteraction) => {
title: ":shopping_cart: Shop [Pterodactyl]" as string,
description: "Something went wrong, please try again later." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,

View file

@ -29,7 +29,7 @@ export default async (interaction: CommandInteraction) => {
title: ":dollar: Shop - Roles [Buy]" as string,
description: "We could not read your requested name." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -37,7 +37,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
await guild?.roles
@ -84,7 +84,7 @@ export default async (interaction: CommandInteraction) => {
value: `${creditNoun(userDB?.credits)}` as string,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,

View file

@ -28,7 +28,7 @@ export default async (interaction: CommandInteraction) => {
title: ":dollar: Shop - Roles [Cancel]" as string,
description: "We could not read your requested role." as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -36,7 +36,7 @@ export default async (interaction: CommandInteraction) => {
};
// Send interaction reply
return await interaction?.editReply({ embeds: [embed] });
return interaction?.editReply({ embeds: [embed] });
}
const roleExist = await shopRolesSchema?.find({
@ -71,7 +71,7 @@ export default async (interaction: CommandInteraction) => {
value: `${creditNoun(userDB?.credits)}` as string,
},
],
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,

View file

@ -41,17 +41,17 @@ export default {
// Module - Lookup
if (options?.getSubcommand() === "lookup") {
// Execute Module - Lookup
return await lookup(interaction);
return lookup(interaction);
}
// Module - About
else if (options?.getSubcommand() === "about") {
// Execute Module - About
return await about(interaction);
return about(interaction);
}
// Module - Stats
else if (options?.getSubcommand() === "stats") {
// Execute Module - Stats
return await stats(interaction);
return stats(interaction);
}
// Send debug message

View file

@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => {
If you are interested in contributing, then just [fork it](https://github.com/ZynerOrg/xyter) yourself, we :heart: Open Source.` as string,
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,

View file

@ -28,7 +28,7 @@ export default async (interaction: CommandInteraction) => {
title: ":hammer: Utilities - Lookup" as string,
description: `${res?.data?.message}: ${res?.data?.query}` as string,
color: config?.colors?.error as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,
@ -95,7 +95,7 @@ export default async (interaction: CommandInteraction) => {
},
],
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,

View file

@ -48,7 +48,7 @@ export default async (interaction: CommandInteraction) => {
},
],
color: config?.colors?.success as ColorResolvable,
timestamp: new Date() as Date,
timestamp: new Date(),
footer: {
iconURL: config?.footer?.icon as string,
text: config?.footer?.text as string,