🧑‍💻 code smell fixes

This commit is contained in:
Axel Olausson Holtenäs 2022-04-10 22:08:03 +02:00
parent 75e9403b47
commit 470e8ce45e
No known key found for this signature in database
GPG key ID: 9347A5E873995701

View file

@ -1,14 +1,14 @@
// Dependencies // Dependencies
import { ColorResolvable, CommandInteraction } from "discord.js"; import { ColorResolvable, CommandInteraction } from 'discord.js';
// Configurations // Configurations
import config from "../../../../../config.json"; import config from '../../../../../config.json';
// Handlers // Handlers
import logger from "../../../../handlers/logger"; import logger from '../../../../handlers/logger';
// Models // Models
import counterSchema from "../../../../helpers/database/models/counterSchema"; import counterSchema from '../../../../helpers/database/models/counterSchema';
// Function // Function
export default async (interaction: CommandInteraction) => { export default async (interaction: CommandInteraction) => {
@ -16,20 +16,19 @@ export default async (interaction: CommandInteraction) => {
const { options, guild, user } = interaction; const { options, guild, user } = interaction;
// Channel option // Channel option
const optionChannel = options?.getChannel("channel"); const optionChannel = options?.getChannel('channel');
// Word option // Word option
const optionWord = options?.getString("word"); const optionWord = options?.getString('word');
// Start option // Start option
const optionStart = options?.getNumber("start"); const optionStart = options?.getNumber('start');
if (optionChannel?.type !== "GUILD_TEXT") { if (optionChannel?.type !== 'GUILD_TEXT') {
// Embed object
const embed = { const embed = {
title: ":toolbox: Admin - Counters [Add]" as string, title: ':toolbox: Admin - Counters [Add]' as string,
description: description:
"That channel is not supported, it needs to be a text channel." as string, 'That channel is not supported, it needs to be a text channel.' as string,
timestamp: new Date() as Date, timestamp: new Date() as Date,
color: config?.colors?.error as ColorResolvable, color: config?.colors?.error as ColorResolvable,
footer: { footer: {
@ -56,9 +55,8 @@ export default async (interaction: CommandInteraction) => {
counter: optionStart || 0, counter: optionStart || 0,
}); });
// Embed object
const embed = { const embed = {
title: ":toolbox: Admin - Counters [Add]" as string, title: ':toolbox: Admin - Counters [Add]' as string,
description: description:
`${optionChannel} is now counting when hearing word ${optionWord} and it starts at number ${ `${optionChannel} is now counting when hearing word ${optionWord} and it starts at number ${
optionStart || 0 optionStart || 0
@ -82,7 +80,7 @@ export default async (interaction: CommandInteraction) => {
// Embed object // Embed object
const embed = { const embed = {
title: ":toolbox: Admin - Counters [Add]" as string, title: ':toolbox: Admin - Counters [Add]' as string,
description: `${optionChannel} is already a counting channel.` as string, description: `${optionChannel} is already a counting channel.` as string,
timestamp: new Date() as Date, timestamp: new Date() as Date,
color: config?.colors?.error as ColorResolvable, color: config?.colors?.error as ColorResolvable,