This commit is contained in:
parent
121b6fbd33
commit
cfc548200a
5
node_modules/.package-lock.json
generated
vendored
5
node_modules/.package-lock.json
generated
vendored
@ -531,6 +531,11 @@
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||
},
|
||||
"node_modules/embed-table": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/embed-table/-/embed-table-4.2.3.tgz",
|
||||
"integrity": "sha512-0gih74lcY63zaeo5WfgS4iLNZER24JPHYmeCeK5pltbtCo+MQsK8YQGDNDb1mgiXMXx6hfQO6lzV/6ATqJTGbw=="
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
|
||||
21
node_modules/embed-table/LICENSE
generated
vendored
Normal file
21
node_modules/embed-table/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Tree Farmer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
49
node_modules/embed-table/README.md
generated
vendored
Normal file
49
node_modules/embed-table/README.md
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
# Embed-Table
|
||||
|
||||
Easily make nice looking text tables for Discord's embed fields and descriptions.
|
||||
|
||||
# Installation
|
||||
|
||||
Install with `npm install embed-table` and it will be installed.
|
||||
|
||||
# Important
|
||||
|
||||
- `titles` are the column titles that will display in the **name** value of the Embed Field. The `titleIndexes` are the indexes of where the titles start in the generated string, it is recommended to have the first title at `0`. [**See example below.**](https://www.npmjs.com/package/embed-table#output)
|
||||
- If the start values are not greater than the previous column name, an error will be thrown about an invalid count value.
|
||||
- **Make sure** that your `titles`, `titleIndexes` and `columnIndexes` all are the same number of values, or else things get messy. An option to make the field inline is available since the method creates a complete field object.
|
||||
- It is easiet to manage where your data lines up in the columns when using backticks ( ` ) at the start and end of the rows, this makes any character the same width.
|
||||
|
||||
# Basic Usage (with Discord.js v14+)
|
||||
```ts
|
||||
import { Table } from 'embed-table';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
|
||||
const table = new Table({
|
||||
titles: ['Level', 'Money', 'Wins'],
|
||||
titleIndexes: [0, 8, 16],
|
||||
columnIndexes: [0, 6, 14],
|
||||
start: '`',
|
||||
end: '`',
|
||||
padEnd: 3
|
||||
});
|
||||
|
||||
table.addRow(['1', '$120', '2'], { override: 4 });
|
||||
table.addRow(['72', '$10', '25'], { override: 0 });
|
||||
table.addRow(['614', '$1220', '12']);
|
||||
|
||||
// Use this 'embed' when sending a message to a channel.
|
||||
const embed = new EmbedBuilder().setFields(table.toField());
|
||||
|
||||
// Use this 'tableString' in a plain text area, (embed description or a regular message)
|
||||
const string = table.toString();
|
||||
```
|
||||
|
||||
# Embed Output
|
||||

|
||||
|
||||
# API
|
||||
Read the documentation for embed-table @ [**embed-table.treefarmer.xyz**](https://embed-table.treefarmer.xyz/)
|
||||
|
||||
# Contributing
|
||||
|
||||
Feel free to contribute however, it is appreciated! Join the community server @ [**treefarmer.xyz/discord**](https://treefarmer.xyz/discord)
|
||||
3
node_modules/embed-table/dist/index.d.ts
generated
vendored
Normal file
3
node_modules/embed-table/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './structures/Table.js';
|
||||
export * from './structures/Row.js';
|
||||
export * from './typings/index.js';
|
||||
20
node_modules/embed-table/dist/index.js
generated
vendored
Normal file
20
node_modules/embed-table/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./structures/Table.js"), exports);
|
||||
__exportStar(require("./structures/Row.js"), exports);
|
||||
__exportStar(require("./typings/index.js"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/embed-table/dist/index.js.map
generated
vendored
Normal file
1
node_modules/embed-table/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,sDAAoC;AAEpC,qDAAmC"}
|
||||
31
node_modules/embed-table/dist/structures/Row.d.ts
generated
vendored
Normal file
31
node_modules/embed-table/dist/structures/Row.d.ts
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
import { RowData } from '../typings/index.js';
|
||||
export declare class Row {
|
||||
/**
|
||||
* The data to insert for each column
|
||||
*/
|
||||
private readonly columns;
|
||||
/**
|
||||
* The starting indexes of each column
|
||||
*/
|
||||
private readonly indexes;
|
||||
/**
|
||||
* Whether or not to include the Whitespace character (\u200b) in spacing (not required if using backticks for the start and end)
|
||||
*/
|
||||
private whiteSpace;
|
||||
/**
|
||||
* Create a new Row to be inserted into a table
|
||||
* @param {RowData} options
|
||||
*/
|
||||
constructor(options: RowData);
|
||||
/**
|
||||
* Convert the row into a string
|
||||
* @returns {string}
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Adds the proper spacing to the data in the row
|
||||
* @param {number} i
|
||||
* @returns {string}
|
||||
*/
|
||||
private padRow;
|
||||
}
|
||||
35
node_modules/embed-table/dist/structures/Row.js
generated
vendored
Normal file
35
node_modules/embed-table/dist/structures/Row.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Row = void 0;
|
||||
class Row {
|
||||
/**
|
||||
* Create a new Row to be inserted into a table
|
||||
* @param {RowData} options
|
||||
*/
|
||||
constructor(options) {
|
||||
this.columns = options.columns;
|
||||
this.indexes = options.indexes;
|
||||
this.whiteSpace = options.whiteSpace;
|
||||
}
|
||||
/**
|
||||
* Convert the row into a string
|
||||
* @returns {string}
|
||||
*/
|
||||
toString() {
|
||||
let res = '';
|
||||
for (let i = 0; i < this.columns.length; i++) {
|
||||
res += this.padRow(i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/**
|
||||
* Adds the proper spacing to the data in the row
|
||||
* @param {number} i
|
||||
* @returns {string}
|
||||
*/
|
||||
padRow(i) {
|
||||
return `${this.whiteSpace ? '\u200b ' : ' '}`.repeat(this.indexes[i] - (this.indexes[i - 1] ?? 0) - (this.columns[i - 1] ? (this.columns[i - 1] + '').length : 0)) + this.columns[i].slice(0, (this.indexes[i + 1] ?? Infinity) - this.indexes[i]);
|
||||
}
|
||||
}
|
||||
exports.Row = Row;
|
||||
//# sourceMappingURL=Row.js.map
|
||||
1
node_modules/embed-table/dist/structures/Row.js.map
generated
vendored
Normal file
1
node_modules/embed-table/dist/structures/Row.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Row.js","sourceRoot":"","sources":["../../src/structures/Row.ts"],"names":[],"mappings":";;;AAEA,MAAa,GAAG;IAgBf;;;OAGG;IACH,YAAmB,OAAgB;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,QAAQ;QACd,IAAI,GAAG,GAAG,EAAE,CAAC;QAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACtB;QAED,OAAO,GAAG,CAAC;IACZ,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,CAAS;QACvB,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,CAAC;IACxP,CAAC;CACD;AAhDD,kBAgDC"}
|
||||
81
node_modules/embed-table/dist/structures/Table.d.ts
generated
vendored
Normal file
81
node_modules/embed-table/dist/structures/Table.d.ts
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
import { TableData, RowOptionData, EmbedField, TableToFieldOptions, TableToStringOptions } from '../typings/index.js';
|
||||
export declare class Table {
|
||||
/**
|
||||
* An array of titles for the Table
|
||||
*/
|
||||
private readonly titles;
|
||||
/**
|
||||
* The starting indexes for each column title in the title string
|
||||
*/
|
||||
private readonly titleIndexes;
|
||||
/**
|
||||
* The starting indexes for each column of data
|
||||
*/
|
||||
private readonly columnIndexes;
|
||||
/**
|
||||
* A string to add to the start of every row
|
||||
*/
|
||||
readonly start: string;
|
||||
/**
|
||||
* A string to add to the end of every row
|
||||
*/
|
||||
readonly end: string;
|
||||
/**
|
||||
* A pad for the end of each row, before the end
|
||||
* @see [String.prototype.padEnd()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd)
|
||||
*/
|
||||
readonly padEnd: number;
|
||||
/**
|
||||
* The Table's generated rows. Do not modify unless you know what you're doing.
|
||||
*/
|
||||
readonly rows: string[];
|
||||
/**
|
||||
* The Table's generated title string
|
||||
*/
|
||||
readonly titleString: string;
|
||||
/**
|
||||
* Whether or not to include the Whitespace character (\u200b) in spacing (not required if using backticks for the start and end)
|
||||
*/
|
||||
private readonly whiteSpace;
|
||||
/**
|
||||
* Create a new Table
|
||||
* @param {TableData} options
|
||||
*/
|
||||
constructor(options: TableData);
|
||||
/**
|
||||
* Add a row with data to the Table
|
||||
* @param {string[]} columns
|
||||
* @param {RowOptionData} options
|
||||
* @returns {this}
|
||||
*/
|
||||
addRow(columns: string[], options?: RowOptionData): this;
|
||||
/**
|
||||
* Convert the Table to an EmbedField object
|
||||
* @param {TableToFieldOptions} options Whether or not the field is inline
|
||||
* @returns {EmbedField} Use this when creating a MessageEmbed
|
||||
*/
|
||||
toField(options?: TableToFieldOptions): EmbedField;
|
||||
/**
|
||||
* Convert the Table to a nice string
|
||||
* @param {TableToStringOptions} options
|
||||
* @returns
|
||||
*/
|
||||
toString(options?: TableToStringOptions): string;
|
||||
/**
|
||||
* Clear the rows out of the Table
|
||||
* @returns {void}
|
||||
*/
|
||||
private clear;
|
||||
/**
|
||||
* Adds the spacing to the titles in the title string
|
||||
* @param {number} i
|
||||
* @returns {string} The padded title
|
||||
*/
|
||||
private padTitle;
|
||||
/**
|
||||
* Checks if the title texts are greater than the indexes provided
|
||||
* Returns true if less than, false if greater than.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
private checkTitles;
|
||||
}
|
||||
102
node_modules/embed-table/dist/structures/Table.js
generated
vendored
Normal file
102
node_modules/embed-table/dist/structures/Table.js
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Table = void 0;
|
||||
const Row_js_1 = require("./Row.js");
|
||||
class Table {
|
||||
/**
|
||||
* Create a new Table
|
||||
* @param {TableData} options
|
||||
*/
|
||||
constructor(options) {
|
||||
this.titleString = '';
|
||||
this.titles = options.titles;
|
||||
this.titleIndexes = options.titleIndexes;
|
||||
this.rows = [];
|
||||
this.columnIndexes = options.columnIndexes;
|
||||
this.start = options.start ?? '';
|
||||
this.end = options.end ?? '';
|
||||
this.padEnd = options.padEnd ?? 0;
|
||||
this.whiteSpace = options.whiteSpace ?? false;
|
||||
if (this.titles.length !== this.titleIndexes.length) {
|
||||
throw new RangeError('The \'titles\' and \'titleIndex\' array must be of the same length.');
|
||||
}
|
||||
for (let i = 0; i < this.titles.length; i++) {
|
||||
this.titleString += this.padTitle(i);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add a row with data to the Table
|
||||
* @param {string[]} columns
|
||||
* @param {RowOptionData} options
|
||||
* @returns {this}
|
||||
*/
|
||||
addRow(columns, options) {
|
||||
this.rows.push((options?.url ? '[' : '') +
|
||||
this.start + new Row_js_1.Row({
|
||||
columns,
|
||||
indexes: this.columnIndexes,
|
||||
whiteSpace: this.whiteSpace
|
||||
})
|
||||
.toString()
|
||||
.padEnd(this.columnIndexes[this.columnIndexes.length - 1] + (options?.override ?? 0 + this.padEnd), ' ') + this.end + (options?.url ? `](${options?.url})` : ''));
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Convert the Table to an EmbedField object
|
||||
* @param {TableToFieldOptions} options Whether or not the field is inline
|
||||
* @returns {EmbedField} Use this when creating a MessageEmbed
|
||||
*/
|
||||
toField(options) {
|
||||
const field = {
|
||||
name: this.titleString,
|
||||
value: this.rows.join('\n'),
|
||||
inline: options?.inline ?? false
|
||||
};
|
||||
if (!options?.keepRows)
|
||||
this.clear();
|
||||
return field;
|
||||
}
|
||||
/**
|
||||
* Convert the Table to a nice string
|
||||
* @param {TableToStringOptions} options
|
||||
* @returns
|
||||
*/
|
||||
toString(options) {
|
||||
const string = this.titleString + '\n' + this.rows.join('\n');
|
||||
if (!options?.keepRows)
|
||||
this.clear();
|
||||
return string;
|
||||
}
|
||||
/**
|
||||
* Clear the rows out of the Table
|
||||
* @returns {void}
|
||||
*/
|
||||
clear() {
|
||||
this.rows.length = 0;
|
||||
}
|
||||
/**
|
||||
* Adds the spacing to the titles in the title string
|
||||
* @param {number} i
|
||||
* @returns {string} The padded title
|
||||
*/
|
||||
padTitle(i) {
|
||||
if (!this.checkTitles()) {
|
||||
throw new RangeError('Length of a \'title\' cannot be longer than the starting index of the next title. Try increasing the value of the subsequent \'titleIndex\'.');
|
||||
}
|
||||
return ' '.repeat(this.titleIndexes[i] - (this.titleIndexes[i - 1] ?? 0) - (this.titles[i - 1]?.length ?? 0)) + this.titles[i].slice(0, (this.titleIndexes[i + 1] ?? Infinity) - this.titleIndexes[i] - 1);
|
||||
}
|
||||
/**
|
||||
* Checks if the title texts are greater than the indexes provided
|
||||
* Returns true if less than, false if greater than.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
checkTitles() {
|
||||
for (let i = 0; i < this.titles.length - 1; i++) {
|
||||
if (this.titles[i].length > this.titleIndexes[i + 1])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
exports.Table = Table;
|
||||
//# sourceMappingURL=Table.js.map
|
||||
1
node_modules/embed-table/dist/structures/Table.js.map
generated
vendored
Normal file
1
node_modules/embed-table/dist/structures/Table.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/structures/Table.ts"],"names":[],"mappings":";;;AAAA,qCAA+B;AAG/B,MAAa,KAAK;IA+CjB;;;OAGG;IACH,YAAmB,OAAkB;QACpC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC;QAC7B,IAAI,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AED;;;;OAIG;IACK,WAAW;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAChD,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAE;gBAAE,OAAO,KAAK,CAAC;SACrE;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA1JD,sBA0JC"}
|
||||
58
node_modules/embed-table/dist/typings/index.d.ts
generated
vendored
Normal file
58
node_modules/embed-table/dist/typings/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
export interface EmbedField {
|
||||
name: string;
|
||||
value: string;
|
||||
inline: boolean;
|
||||
}
|
||||
export interface TableData {
|
||||
/**
|
||||
* An array of titles for the Table
|
||||
*/
|
||||
titles: string[];
|
||||
/**
|
||||
* The starting indexes for each title
|
||||
*/
|
||||
titleIndexes: number[];
|
||||
/**
|
||||
* The starting indexes for each column of data
|
||||
*/
|
||||
columnIndexes: number[];
|
||||
/**
|
||||
* A string to add to the beginning of every row
|
||||
*/
|
||||
start?: string;
|
||||
/**
|
||||
* A string to add to the end of every row
|
||||
*/
|
||||
end?: string;
|
||||
/**
|
||||
* A pad for the end of each row, before the end
|
||||
* @see [String.prototype.padEnd()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd)
|
||||
*/
|
||||
padEnd?: number;
|
||||
/**
|
||||
* Whether or not to include the Whitespace character (\u200b) in spacing (not required if using backticks for the start and end)
|
||||
*/
|
||||
whiteSpace?: boolean;
|
||||
}
|
||||
export interface TableToFieldOptions extends TableToStringOptions {
|
||||
inline?: boolean;
|
||||
}
|
||||
export interface TableToStringOptions {
|
||||
keepRows?: boolean;
|
||||
}
|
||||
export interface RowData {
|
||||
columns: string[];
|
||||
indexes: number[];
|
||||
whiteSpace: boolean;
|
||||
}
|
||||
export interface RowOptionData {
|
||||
/**
|
||||
* Override the table's default padEnd in the row
|
||||
*/
|
||||
override?: number;
|
||||
/**
|
||||
* A URL to wrap around the row as a hyperlink.
|
||||
* Only works with table.toString() inside embed description or table.toField() inside embed field.
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
3
node_modules/embed-table/dist/typings/index.js
generated
vendored
Normal file
3
node_modules/embed-table/dist/typings/index.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/embed-table/dist/typings/index.js.map
generated
vendored
Normal file
1
node_modules/embed-table/dist/typings/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/typings/index.ts"],"names":[],"mappings":""}
|
||||
45
node_modules/embed-table/package.json
generated
vendored
Normal file
45
node_modules/embed-table/package.json
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "embed-table",
|
||||
"version": "4.2.3",
|
||||
"description": "Easily make nice looking text tables for Discord's embed fields and descriptions.",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
"dist/**/*"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"lint": "eslint --cache --fix",
|
||||
"start": "npm run lint && npm run build && node .",
|
||||
"check": "npm run lint && tsc --noEmit",
|
||||
"prepack": "npm run build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/TreeFarmer/embed-table.git"
|
||||
},
|
||||
"keywords": [
|
||||
"discord",
|
||||
"discordjs",
|
||||
"messageembed",
|
||||
"table"
|
||||
],
|
||||
"author": {
|
||||
"email": "contact@luyx.dev",
|
||||
"name": "Luyx LLC",
|
||||
"url": "https://luyx.dev"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/TreeFarmer/embed-table/issues"
|
||||
},
|
||||
"homepage": "https://embed-table.treefarmer.xyz",
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.13.0",
|
||||
"eslint": "^8.33.0",
|
||||
"typedoc": "^0.23.24",
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"directories": {
|
||||
"doc": "docs"
|
||||
}
|
||||
}
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@ -13,6 +13,7 @@
|
||||
"chokidar": "^4.0.3",
|
||||
"commander": "^13.1.0",
|
||||
"discord.js": "^14.18.0",
|
||||
"embed-table": "^4.2.3",
|
||||
"express": "^5.1.0",
|
||||
"multer": "^1.4.5-lts.2",
|
||||
"mysql2": "^3.14.0",
|
||||
@ -551,6 +552,11 @@
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||
},
|
||||
"node_modules/embed-table": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/embed-table/-/embed-table-4.2.3.tgz",
|
||||
"integrity": "sha512-0gih74lcY63zaeo5WfgS4iLNZER24JPHYmeCeK5pltbtCo+MQsK8YQGDNDb1mgiXMXx6hfQO6lzV/6ATqJTGbw=="
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
"chokidar": "^4.0.3",
|
||||
"commander": "^13.1.0",
|
||||
"discord.js": "^14.18.0",
|
||||
"embed-table": "^4.2.3",
|
||||
"express": "^5.1.0",
|
||||
"multer": "^1.4.5-lts.2",
|
||||
"mysql2": "^3.14.0",
|
||||
|
||||
@ -20,12 +20,7 @@ module.exports = {
|
||||
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// está a ir buscar dados a sql e meter como tabela! nao mexer!
|
||||
try {
|
||||
const [rows] = await conn.execute('SELECT discord_id, discord_username, cargo FROM users');
|
||||
if (!rows.length) return await interaction.editReply('Nenhum membro encontrado.');
|
||||
@ -49,8 +44,19 @@ module.exports = {
|
||||
console.error('Erro ao acessar o banco de dados:', error);
|
||||
await interaction.editReply({ content: 'Erro ao carregar os dados dos membros!' });
|
||||
}
|
||||
// está a ir buscar dados a sql e meter como tabela! nao mexer!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user