From 384a74f1169b450c3f3ce10d9b40b3f241004e4f Mon Sep 17 00:00:00 2001 From: Evorp <3vorpgaming@gmail.com> Date: Tue, 24 Oct 2023 22:33:03 -0700 Subject: [PATCH] remove unused date function --- src/commands/bot/botban.ts | 8 ++++---- src/components/menus/textureSelect.ts | 2 +- src/helpers/utility/dates.ts | 22 ++++------------------ 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/src/commands/bot/botban.ts b/src/commands/bot/botban.ts index d076a9040..dffb2b2a4 100644 --- a/src/commands/bot/botban.ts +++ b/src/commands/bot/botban.ts @@ -106,15 +106,15 @@ export const command: SlashCommand = { files: [new AttachmentBuilder(buffer, { name: "bans.json" })], }); case "embed": - const emb = new EmbedBuilder() + const embed = new EmbedBuilder() .setTitle("Botbanned IDs:") .setDescription(JSON.parse(buffer.toString("utf-8"))["ids"].join("\n")); - return interaction.editReply({ embeds: [emb] }); + return interaction.editReply({ embeds: [embed] }); case "mentions": - const pingEmb = new EmbedBuilder() + const pingEmbed = new EmbedBuilder() .setTitle("Botbanned Users:") .setDescription("<@" + JSON.parse(buffer.toString("utf-8"))["ids"].join(">\n<@") + ">"); - return interaction.editReply({ embeds: [pingEmb] }); + return interaction.editReply({ embeds: [pingEmbed] }); default: // also text interaction.editReply({ files: [new AttachmentBuilder(txtBuff, { name: "bans.txt" })], diff --git a/src/components/menus/textureSelect.ts b/src/components/menus/textureSelect.ts index 8ab719ba1..338a9ac98 100644 --- a/src/components/menus/textureSelect.ts +++ b/src/components/menus/textureSelect.ts @@ -1,7 +1,7 @@ import { Client, Message, StringSelectMenuInteraction } from "@client"; import { Component } from "@interfaces"; import { info } from "@helpers/logger"; -import { MessageEditOptions, MessageInteraction } from "discord.js"; +import { MessageInteraction } from "discord.js"; import { getTexture } from "@functions/getTexture"; import axios from "axios"; diff --git a/src/helpers/utility/dates.ts b/src/helpers/utility/dates.ts index 32f5b8003..9b41030ca 100644 --- a/src/helpers/utility/dates.ts +++ b/src/helpers/utility/dates.ts @@ -1,16 +1,3 @@ -/** - * Add minutes to a date - * @author Juknum - * @param d the date to add minutes to - * @param minutes the number of minutes to add - * @returns the new date - */ -export const addMinutes = (d: Date, minutes?: number): Date => { - if (minutes === null || minutes === undefined) minutes = 1; - d.setMinutes(d.getMinutes() + minutes); - return d; -}; - /** * Add seconds to a date * @author Juknum @@ -18,9 +5,8 @@ export const addMinutes = (d: Date, minutes?: number): Date => { * @param seconds the number of seconds to add * @returns the new date */ -export const addSeconds = (d: Date, seconds?: number): Date => { - if (seconds === null || seconds === undefined) seconds = 1; - d.setSeconds(d.getSeconds() + seconds); +export const addSeconds = (d: Date, seconds?: number) => { + d.setSeconds(d.getSeconds() + seconds ?? 1); return d; }; @@ -52,10 +38,10 @@ export const parseDate = (d: string) => { * @param t timestamp to convert * @returns human readable format */ -export const fromTimestampToHumanReadable = (t: number): string => { +export const fromTimestampToHumanReadable = (t: number) => { if (t === undefined) return "01/01/1970"; - let date = new Date(parseInt(t.toString())); // cast to int because it might be a string + let date = new Date(Number(t)); // cast to int because it might be a string return `${date.getDate() < 10 ? `0${date.getDate()}` : date.getDate()}/${ date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1 }/${date.getFullYear()}`;