From 1121815b058f2df76ebb5102e353a94422969644 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Sat, 28 Jan 2023 08:59:37 +1100 Subject: [PATCH] why is this here? --- src/client.ts | 35 +---------------------------------- src/typings/interfaces.d.ts | 5 ----- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/src/client.ts b/src/client.ts index 30aa082..1de11d2 100644 --- a/src/client.ts +++ b/src/client.ts @@ -2,7 +2,7 @@ import Discord, { Client, GatewayIntentBits, Partials } from 'discord.js'; import fs from 'node:fs'; import { Database } from './database'; import timeNames from './timeNames'; -import { Punishment, formatTimeOpt, createTableOpt, punOpt, Tokens, Config } from './typings/interfaces'; +import { Punishment, formatTimeOpt, punOpt, Tokens, Config } from './typings/interfaces'; import MPDB from './models/MPServer'; import axios from 'axios'; import moment from 'moment'; @@ -140,39 +140,6 @@ export class TClient extends Client { text = text + emptyChar.repeat(length - text.length); } return text; } - createTable(columnTitles = [], rowsData = [], options: createTableOpt, client: TClient){ - const rows: any = []; - let { columnAlign = [], columnSeparator = [], columnEmptyChar = [] } = options; - if (columnSeparator.length < 1) columnSeparator.push('|'); - columnSeparator = columnSeparator.map((x: string)=>`${x}`); - // col widths - const columnWidths = columnTitles.map((title: any, i)=>Math.max(title.length, ...rowsData.map((x: any)=>x[i].length))); - // first row - rows.push(columnTitles.map((title, i)=>{ - let text = client.alignText(title, columnWidths[i], columnAlign[i], columnEmptyChar[i]); - if (columnSeparator[i]){ - text += ' '.repeat(columnSeparator[i].length); - } - return text; - }).join('')) - // big line - rows.push('━'.repeat(rows[0].length)); - //data - // remove unicode - rowsData.map((row: any)=>{ - return row.map((element: string)=>{ - return element.split('').map((char: string)=>{ - if (char.charCodeAt(0)>128) return '□'; - }).join('') - }) - }) - rows.push(rowsData.map((row: any)=>row.map((element: string, i: number)=>{ - return client.alignText(element, columnWidths[i], columnEmptyChar[i])+(i === columnTitles.length - 1 ? '' : columnSeparator[i]); - }).join('') - ).join('\n')) - - return rows.join('\n'); - } async punish(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>, type: string){ if (!client.isStaff(interaction.member as Discord.GuildMember)) return client.youNeedRole(interaction, "dcmod"); diff --git a/src/typings/interfaces.d.ts b/src/typings/interfaces.d.ts index e04ec08..e3e91a6 100644 --- a/src/typings/interfaces.d.ts +++ b/src/typings/interfaces.d.ts @@ -8,11 +8,6 @@ export interface formatTimeOpt { longNames: boolean, commas: boolean } -export interface createTableOpt { - columnAlign: any, - columnSeparator: any, - columnEmptyChar: any -} export interface punOpt { time?: string, reason?: string,