Skip to content

Commit

Permalink
remove unused date function
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Oct 25, 2023
1 parent 12e02af commit 384a74f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/commands/bot/botban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" })],
Expand Down
2 changes: 1 addition & 1 deletion src/components/menus/textureSelect.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
22 changes: 4 additions & 18 deletions src/helpers/utility/dates.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
/**
* 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
* @param d the date to add seconds to
* @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;
};

Expand Down Expand Up @@ -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()}`;
Expand Down

0 comments on commit 384a74f

Please sign in to comment.