@zoodogood/utils 6.0.0-change.4442 → 8.1.0-change.5430
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accumulator/index.d.ts +8 -0
- package/dist/Accumulator/index.d.ts.map +1 -0
- package/dist/Accumulator/index.js +14 -0
- package/dist/Matrix2d/index.d.ts +9 -0
- package/dist/Matrix2d/index.d.ts.map +1 -0
- package/dist/Matrix2d/index.js +20 -0
- package/dist/discordjs/chain/configuration.d.ts +7 -0
- package/dist/discordjs/chain/configuration.d.ts.map +1 -0
- package/{lib → dist}/discordjs/chain/get_chain_array.d.ts +1 -1
- package/{lib → dist}/discordjs/chain/get_chain_array.d.ts.map +1 -1
- package/{lib → dist}/discordjs/chain/get_chain_array.js +4 -4
- package/{lib → dist}/discordjs/chain/lifecycle.d.ts +1 -1
- package/{lib → dist}/discordjs/chain/lifecycle.d.ts.map +1 -1
- package/{lib → dist}/discordjs/chain/lifecycle.js +4 -4
- package/{lib → dist}/discordjs/chain/map.d.ts +1 -1
- package/{lib → dist}/discordjs/chain/map.d.ts.map +1 -1
- package/{lib → dist}/discordjs/chain/move_partial_data_to_chain.d.ts +3 -3
- package/dist/discordjs/chain/move_partial_data_to_chain.d.ts.map +1 -0
- package/{lib → dist}/discordjs/chain/move_partial_data_to_chain.js +22 -23
- package/dist/discordjs/helpers.d.ts +3 -0
- package/{lib → dist}/discordjs/helpers.d.ts.map +1 -1
- package/dist/discordjs/main_embed_of.d.ts +4 -0
- package/{lib → dist}/discordjs/main_embed_of.d.ts.map +1 -1
- package/{lib → dist}/discordjs/message_components.d.ts +1 -1
- package/dist/discordjs/message_components.d.ts.map +1 -0
- package/{lib → dist}/discordjs/message_components.js +3 -3
- package/{lib → dist}/discordjs/message_content_limits.d.ts +1 -1
- package/dist/discordjs/message_content_limits.d.ts.map +1 -0
- package/{lib → dist}/discordjs/message_content_limits.js +4 -4
- package/{lib → dist}/discordjs/message_lifecycle.d.ts +4 -4
- package/dist/discordjs/message_lifecycle.d.ts.map +1 -0
- package/{lib → dist}/discordjs/message_lifecycle.js +23 -21
- package/dist/discordjs/mod.d.ts +12 -0
- package/dist/discordjs/mod.d.ts.map +1 -0
- package/dist/discordjs/mod.js +11 -0
- package/{lib → dist}/discordjs/modal.d.ts +3 -3
- package/dist/discordjs/modal.d.ts.map +1 -0
- package/{lib → dist}/discordjs/modal.js +7 -7
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/lazy/index.d.ts +6 -0
- package/dist/lazy/index.d.ts.map +1 -0
- package/dist/lazy/index.js +8 -0
- package/{lib → dist}/nodejs/getChildProcessUtils.d.ts +2 -2
- package/dist/nodejs/getChildProcessUtils.d.ts.map +1 -0
- package/{lib → dist}/nodejs/getChildProcessUtils.js +27 -27
- package/{lib → dist}/nodejs/mod.d.ts.map +1 -1
- package/dist/objectToStrings/index.d.ts +2 -0
- package/dist/objectToStrings/index.d.ts.map +1 -0
- package/dist/objectToStrings/index.js +3 -0
- package/{lib → dist}/objectives/BusyNumeric.d.ts.map +1 -1
- package/{lib → dist}/objectives/BusyNumeric.js +9 -7
- package/dist/objectives/CustomCollector.d.ts +25 -0
- package/dist/objectives/CustomCollector.d.ts.map +1 -0
- package/{lib → dist}/objectives/CustomCollector.js +3 -3
- package/dist/objectives/DotNotatedInterface.d.ts +25 -0
- package/dist/objectives/DotNotatedInterface.d.ts.map +1 -0
- package/{lib → dist}/objectives/DotNotatedInterface.js +19 -14
- package/{lib → dist}/objectives/ExtendedEnum/BooleanWithMessage.d.ts +1 -1
- package/dist/objectives/ExtendedEnum/BooleanWithMessage.d.ts.map +1 -0
- package/{lib → dist}/objectives/ExtendedEnum/BooleanWithMessage.js +1 -1
- package/{lib → dist}/objectives/ExtendedEnum/Option.d.ts +1 -1
- package/dist/objectives/ExtendedEnum/Option.d.ts.map +1 -0
- package/{lib → dist}/objectives/ExtendedEnum/Option.js +1 -1
- package/{lib → dist}/objectives/ExtendedEnum/Result.d.ts +1 -1
- package/dist/objectives/ExtendedEnum/Result.d.ts.map +1 -0
- package/{lib → dist}/objectives/ExtendedEnum/Result.js +1 -1
- package/dist/objectives/ExtendedEnum/index.d.ts +2 -0
- package/{lib → dist}/objectives/ExtendedEnum/index.d.ts.map +1 -1
- package/dist/objectives/ExtendedEnum/index.js +1 -0
- package/{lib → dist}/objectives/ExtendedEnum/main.d.ts +5 -2
- package/dist/objectives/ExtendedEnum/main.d.ts.map +1 -0
- package/{lib → dist}/objectives/ExtendedEnum/main.js +13 -9
- package/dist/objectives/ExtendedEnum/mod.d.ts +5 -0
- package/{lib → dist}/objectives/ExtendedEnum/mod.d.ts.map +1 -1
- package/dist/objectives/ExtendedEnum/mod.js +4 -0
- package/dist/objectives/GlitchText.d.ts.map +1 -0
- package/{lib → dist}/objectives/GlitchText.js +9 -10
- package/{lib → dist}/objectives/LazySort/LazySort.build.d.ts +4 -4
- package/dist/objectives/LazySort/LazySort.build.d.ts.map +1 -0
- package/{lib → dist}/objectives/LazySort/LazySort.build.js +61 -36
- package/{lib → dist}/objectives/equal.d.ts.map +1 -1
- package/{lib → dist}/objectives/equal.js +2 -2
- package/dist/objectives/makeArray.d.ts +2 -0
- package/dist/objectives/makeArray.d.ts.map +1 -0
- package/dist/objectives/makeArray.js +3 -0
- package/dist/objectives/mod.d.ts +15 -0
- package/dist/objectives/mod.d.ts.map +1 -0
- package/dist/objectives/mod.js +15 -0
- package/{lib/objectives/getRandomElementFromArray.d.ts → dist/objectives/randomElementFromArray.d.ts} +6 -6
- package/dist/objectives/randomElementFromArray.d.ts.map +1 -0
- package/{lib/objectives/getRandomElementFromArray.js → dist/objectives/randomElementFromArray.js} +16 -16
- package/dist/objectives/randomNumberInRange.d.ts +8 -0
- package/dist/objectives/randomNumberInRange.d.ts.map +1 -0
- package/{lib/objectives/getRandomNumberInRange.js → dist/objectives/randomNumberInRange.js} +2 -2
- package/dist/primitives/BracketsParser.d.ts.map +1 -0
- package/{lib → dist}/primitives/BracketsParser.js +18 -15
- package/{lib → dist}/primitives/CliParser.d.ts +3 -3
- package/dist/primitives/CliParser.d.ts.map +1 -0
- package/{lib → dist}/primitives/CliParser.js +35 -30
- package/{lib → dist}/primitives/TextTableBuilder.d.ts +3 -3
- package/dist/primitives/TextTableBuilder.d.ts.map +1 -0
- package/{lib → dist}/primitives/TextTableBuilder.js +24 -24
- package/dist/primitives/binary_search.d.ts +10 -0
- package/dist/primitives/binary_search.d.ts.map +1 -0
- package/dist/primitives/binary_search.js +32 -0
- package/dist/primitives/mod.d.ts +14 -0
- package/dist/primitives/mod.d.ts.map +1 -0
- package/dist/primitives/mod.js +25 -0
- package/dist/primitives/pluralization/index.d.ts +13 -0
- package/dist/primitives/pluralization/index.d.ts.map +1 -0
- package/dist/primitives/pluralization/index.js +107 -0
- package/{lib → dist}/primitives/symbols.d.ts.map +1 -1
- package/dist/primitives/symbols.js +1 -0
- package/dist/tapLog/index.d.ts +2 -0
- package/dist/tapLog/index.d.ts.map +1 -0
- package/dist/tapLog/index.js +4 -0
- package/dist/type-helpers/MaybePromise.d.ts +2 -0
- package/dist/type-helpers/MaybePromise.d.ts.map +1 -0
- package/dist/type-helpers/MaybePromise.js +1 -0
- package/dist/type-helpers/index.d.ts +2 -0
- package/dist/type-helpers/index.d.ts.map +1 -0
- package/dist/type-helpers/index.js +1 -0
- package/dist/useLazy/index.d.ts +2 -0
- package/dist/useLazy/index.d.ts.map +1 -0
- package/dist/useLazy/index.js +4 -0
- package/package.json +36 -40
- package/lib/discordjs/chain/configuration.d.ts +0 -7
- package/lib/discordjs/chain/configuration.d.ts.map +0 -1
- package/lib/discordjs/chain/move_partial_data_to_chain.d.ts.map +0 -1
- package/lib/discordjs/helpers.d.ts +0 -3
- package/lib/discordjs/main_embed_of.d.ts +0 -4
- package/lib/discordjs/message_components.d.ts.map +0 -1
- package/lib/discordjs/message_content_limits.d.ts.map +0 -1
- package/lib/discordjs/message_lifecycle.d.ts.map +0 -1
- package/lib/discordjs/mod.d.ts +0 -12
- package/lib/discordjs/mod.d.ts.map +0 -1
- package/lib/discordjs/mod.js +0 -11
- package/lib/discordjs/modal.d.ts.map +0 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -2
- package/lib/nodejs/getChildProcessUtils.d.ts.map +0 -1
- package/lib/objectives/CustomCollector.d.ts +0 -25
- package/lib/objectives/CustomCollector.d.ts.map +0 -1
- package/lib/objectives/DotNotatedInterface.d.ts +0 -24
- package/lib/objectives/DotNotatedInterface.d.ts.map +0 -1
- package/lib/objectives/ExtendedEnum/BooleanWithMessage.d.ts.map +0 -1
- package/lib/objectives/ExtendedEnum/Option.d.ts.map +0 -1
- package/lib/objectives/ExtendedEnum/Result.d.ts.map +0 -1
- package/lib/objectives/ExtendedEnum/index.d.ts +0 -2
- package/lib/objectives/ExtendedEnum/index.js +0 -1
- package/lib/objectives/ExtendedEnum/main.d.ts.map +0 -1
- package/lib/objectives/ExtendedEnum/mod.d.ts +0 -5
- package/lib/objectives/ExtendedEnum/mod.js +0 -4
- package/lib/objectives/GlitchText.d.ts.map +0 -1
- package/lib/objectives/LazySort/LazySort.build.d.ts.map +0 -1
- package/lib/objectives/getRandomElementFromArray.d.ts.map +0 -1
- package/lib/objectives/getRandomNumberInRange.d.ts +0 -8
- package/lib/objectives/getRandomNumberInRange.d.ts.map +0 -1
- package/lib/objectives/mod.d.ts +0 -14
- package/lib/objectives/mod.d.ts.map +0 -1
- package/lib/objectives/mod.js +0 -14
- package/lib/primitives/BracketsParser.d.ts.map +0 -1
- package/lib/primitives/CliParser.d.ts.map +0 -1
- package/lib/primitives/TextTableBuilder.d.ts.map +0 -1
- package/lib/primitives/binary_search.d.ts +0 -10
- package/lib/primitives/binary_search.d.ts.map +0 -1
- package/lib/primitives/binary_search.js +0 -22
- package/lib/primitives/mod.d.ts +0 -17
- package/lib/primitives/mod.d.ts.map +0 -1
- package/lib/primitives/mod.js +0 -35
- package/lib/primitives/symbols.js +0 -1
- /package/{lib → dist}/discordjs/chain/configuration.js +0 -0
- /package/{lib → dist}/discordjs/chain/map.js +0 -0
- /package/{lib → dist}/discordjs/helpers.js +0 -0
- /package/{lib → dist}/discordjs/main_embed_of.js +0 -0
- /package/{lib → dist}/nodejs/mod.d.ts +0 -0
- /package/{lib → dist}/nodejs/mod.js +0 -0
- /package/{lib → dist}/objectives/BusyNumeric.d.ts +0 -0
- /package/{lib → dist}/objectives/GlitchText.d.ts +0 -0
- /package/{lib → dist}/objectives/equal.d.ts +0 -0
- /package/{lib → dist}/objectives/rangeToArray.d.ts +0 -0
- /package/{lib → dist}/objectives/rangeToArray.d.ts.map +0 -0
- /package/{lib → dist}/objectives/rangeToArray.js +0 -0
- /package/{lib → dist}/primitives/BracketsParser.d.ts +0 -0
- /package/{lib → dist}/primitives/createDefaultPreventable.d.ts +0 -0
- /package/{lib → dist}/primitives/createDefaultPreventable.d.ts.map +0 -0
- /package/{lib → dist}/primitives/createDefaultPreventable.js +0 -0
- /package/{lib → dist}/primitives/normalize.d.ts +0 -0
- /package/{lib → dist}/primitives/normalize.d.ts.map +0 -0
- /package/{lib → dist}/primitives/normalize.js +0 -0
- /package/{lib → dist}/primitives/symbols.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Accumulator/index.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW,CAAC,KAAK,EAAE,CAAC;;IAG/B,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,KAAK,KAAK,EAC7C,OAAO,EAAE,KAAK;IAKf,IAAI,CAAC,CAAC,EAAE,CAAC;IAIT,QAAQ;CAGR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class Accumulator {
|
|
2
|
+
reduceFn;
|
|
3
|
+
#state;
|
|
4
|
+
constructor(reduceFn, initial) {
|
|
5
|
+
this.reduceFn = reduceFn;
|
|
6
|
+
this.#state = initial;
|
|
7
|
+
}
|
|
8
|
+
push(v) {
|
|
9
|
+
this.#state = this.reduceFn(this.#state, v);
|
|
10
|
+
}
|
|
11
|
+
getState() {
|
|
12
|
+
return this.#state;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class Matrix2d<T> {
|
|
2
|
+
sequence: T[];
|
|
3
|
+
columnSize: number;
|
|
4
|
+
rowSize: number;
|
|
5
|
+
fromRows(rows: T[][]): void;
|
|
6
|
+
constructor(sequence: T[], columnSize: number, rowSize: number);
|
|
7
|
+
at(x: number, y: number): T | undefined;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Matrix2d/index.ts"],"names":[],"mappings":"AAEA,qBAAa,QAAQ,CAAC,CAAC;IAQd,QAAQ,EAAE,CAAC,EAAE;IACb,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IATvB,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;gBAOZ,QAAQ,EAAE,CAAC,EAAE,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM;IAGvB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;CAGvB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class IteratorWithLength {
|
|
2
|
+
}
|
|
3
|
+
export class Matrix2d {
|
|
4
|
+
sequence;
|
|
5
|
+
columnSize;
|
|
6
|
+
rowSize;
|
|
7
|
+
fromRows(rows) {
|
|
8
|
+
const rl = rows[0].length;
|
|
9
|
+
const cl = rows.length;
|
|
10
|
+
new Matrix2d(rows.flat(1), cl, rl);
|
|
11
|
+
}
|
|
12
|
+
constructor(sequence, columnSize, rowSize) {
|
|
13
|
+
this.sequence = sequence;
|
|
14
|
+
this.columnSize = columnSize;
|
|
15
|
+
this.rowSize = rowSize;
|
|
16
|
+
}
|
|
17
|
+
at(x, y) {
|
|
18
|
+
return this.sequence.at(x + y * this.rowSize);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DiscordContentLimites } from '../message_content_limits.js';
|
|
2
|
+
export interface MaySplitConfiguration {
|
|
3
|
+
fields?: (keyof typeof DiscordContentLimites)[];
|
|
4
|
+
separateBy?: string;
|
|
5
|
+
splay?: 'balanced' | 'rest';
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/discordjs/chain/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE,MAAM,WAAW,qBAAqB;IACrC,MAAM,CAAC,EAAE,CAAC,MAAM,OAAO,qBAAqB,CAAC,EAAE,CAAA;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;CAC3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Client, Message } from
|
|
1
|
+
import type { Client, Message } from 'discord.js';
|
|
2
2
|
export declare const _chain_parent: unique symbol;
|
|
3
3
|
export declare const _chain_child: unique symbol;
|
|
4
4
|
export declare function get_chain_array(partId: string, client: Client): Promise<Array<Message | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_chain_array.d.ts","sourceRoot":"","sources":["../../../src/discordjs/chain/get_chain_array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAoB,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"get_chain_array.d.ts","sourceRoot":"","sources":["../../../src/discordjs/chain/get_chain_array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAoB,MAAM,YAAY,CAAA;AAGnE,eAAO,MAAM,aAAa,eAAmB,CAAA;AAC7C,eAAO,MAAM,YAAY,eAAkB,CAAA;AAE3C,wBAAsB,eAAe,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAe1C"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { chain_map } from
|
|
2
|
-
export const _chain_parent = Symbol(
|
|
3
|
-
export const _chain_child = Symbol(
|
|
1
|
+
import { chain_map } from './map.js';
|
|
2
|
+
export const _chain_parent = Symbol('parent');
|
|
3
|
+
export const _chain_child = Symbol('child');
|
|
4
4
|
export async function get_chain_array(partId, client) {
|
|
5
5
|
// В порядке от потомка к родителю
|
|
6
6
|
const [channelId, ...parts] = chain_map.get(partId);
|
|
7
7
|
const channel = client.channels.cache.get(channelId);
|
|
8
8
|
return await Promise.all(parts.map((id) => channel.messages.fetch(id).catch((error) => {
|
|
9
|
-
if (error.message !==
|
|
9
|
+
if (error.message !== 'Unknown Message') {
|
|
10
10
|
throw error;
|
|
11
11
|
}
|
|
12
12
|
return { id };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Message } from
|
|
1
|
+
import { Message } from 'discord.js';
|
|
2
2
|
export declare const propogate: any;
|
|
3
3
|
export declare function onMessageDelete(message: Message): Promise<void>;
|
|
4
4
|
export declare function onPropogableEvent(eventType: string, direct_target: Message, rest: unknown): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/discordjs/chain/lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/discordjs/chain/lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAIpC,eAAO,MAAM,SAAS,KAAqB,CAAA;AAC3C,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,iBAerD;AAED,wBAAsB,iBAAiB,CACtC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,OAAO,iBASb"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { get_chain_array } from
|
|
4
|
-
import { chain_map } from
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { Message } from 'discord.js';
|
|
3
|
+
import { get_chain_array } from './get_chain_array.js';
|
|
4
|
+
import { chain_map } from './map.js';
|
|
5
5
|
export const propogate = new EventEmitter();
|
|
6
6
|
export async function onMessageDelete(message) {
|
|
7
7
|
const messages = chain_map.has(message.id) &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/discordjs/chain/map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/discordjs/chain/map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,cAAM,KAAM,SAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;;IAqBxC,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;CAYzD;AAED,eAAO,MAAM,SAAS,OAAc,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type diagnosticLimits } from
|
|
2
|
-
import { type AdvancedPayload, type createMessage } from
|
|
3
|
-
import type { MaySplitConfiguration } from
|
|
1
|
+
import { type diagnosticLimits } from '../message_content_limits.js';
|
|
2
|
+
import { type AdvancedPayload, type createMessage } from '../message_lifecycle.js';
|
|
3
|
+
import type { MaySplitConfiguration } from './configuration.js';
|
|
4
4
|
export declare function move_partial_data_to_chain(mut_original: AdvancedPayload, splitConfigutation: MaySplitConfiguration, limitsDiagnostic: ReturnType<typeof diagnosticLimits>): undefined;
|
|
5
5
|
export declare function _rob_already_prepared(mut_message_data: ReturnType<typeof createMessage>, mut_payload: AdvancedPayload): void;
|
|
6
6
|
//# sourceMappingURL=move_partial_data_to_chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move_partial_data_to_chain.d.ts","sourceRoot":"","sources":["../../../src/discordjs/chain/move_partial_data_to_chain.ts"],"names":[],"mappings":"AAKA,OAAO,EAEN,KAAK,gBAAgB,EACrB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAe/D,wBAAgB,0BAA0B,CACzC,YAAY,EAAE,eAAe,EAC7B,kBAAkB,EAAE,qBAAqB,EACzC,gBAAgB,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,aA6LrD;AAID,wBAAgB,qBAAqB,CACpC,gBAAgB,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,EAClD,WAAW,EAAE,eAAe,QAY5B"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
// declare state in file://./readme.md
|
|
2
|
-
import { DEFAULT } from
|
|
3
|
-
import { main_embed_of } from
|
|
4
|
-
import { DiscordContentLimites, } from
|
|
5
|
-
import { isEmptyEmbed, } from
|
|
2
|
+
import { DEFAULT } from '../../primitives/symbols.js';
|
|
3
|
+
import { main_embed_of } from '../main_embed_of.js';
|
|
4
|
+
import { DiscordContentLimites, } from '../message_content_limits.js';
|
|
5
|
+
import { isEmptyEmbed, } from '../message_lifecycle.js';
|
|
6
6
|
function tryMultipleMap(callback, limit = 10) {
|
|
7
|
-
let iteration = 0;
|
|
8
|
-
while (true) {
|
|
7
|
+
for (let iteration = 0; iteration < limit; iteration++) {
|
|
9
8
|
try {
|
|
10
|
-
return callback(iteration
|
|
9
|
+
return callback(iteration);
|
|
11
10
|
}
|
|
12
11
|
catch (error) {
|
|
13
|
-
if (iteration
|
|
12
|
+
if (iteration === limit - 1) {
|
|
14
13
|
throw error;
|
|
15
14
|
}
|
|
16
|
-
/* continue*/
|
|
17
15
|
}
|
|
18
16
|
}
|
|
17
|
+
throw new Error('Retry limit reached without success.');
|
|
19
18
|
}
|
|
20
19
|
export function move_partial_data_to_chain(mut_original, splitConfigutation, limitsDiagnostic) {
|
|
21
20
|
const chain_child = {};
|
|
@@ -26,11 +25,11 @@ export function move_partial_data_to_chain(mut_original, splitConfigutation, lim
|
|
|
26
25
|
return void 0;
|
|
27
26
|
}
|
|
28
27
|
const exceeding = Object.entries(limitsDiagnostic.exceeding).filter(([_key, value]) => value > 0);
|
|
29
|
-
const { separateBy =
|
|
28
|
+
const { separateBy = '\n' } = splitConfigutation;
|
|
30
29
|
const prepared = exceeding.map(([key]) => {
|
|
31
30
|
switch (key) {
|
|
32
|
-
case
|
|
33
|
-
case
|
|
31
|
+
case 'content':
|
|
32
|
+
case 'description':
|
|
34
33
|
return (() => {
|
|
35
34
|
const chunks = mut_original[key]
|
|
36
35
|
.split(separateBy)
|
|
@@ -46,13 +45,13 @@ export function move_partial_data_to_chain(mut_original, splitConfigutation, lim
|
|
|
46
45
|
}));
|
|
47
46
|
chunks.forEach(($) => {
|
|
48
47
|
if ($.chunk.length > DiscordContentLimites[key]) {
|
|
49
|
-
throw new Error(
|
|
48
|
+
throw new Error('As a result of splitting large text, spliceBy did not find any potential separation points (https://github.com/zoodogood/1119/issues/8)');
|
|
50
49
|
}
|
|
51
50
|
});
|
|
52
51
|
return [key, chunks];
|
|
53
52
|
})();
|
|
54
|
-
case
|
|
55
|
-
return [
|
|
53
|
+
case 'fields_count':
|
|
54
|
+
return ['fields', mut_original.fields];
|
|
56
55
|
default:
|
|
57
56
|
return [key, mut_original[key]];
|
|
58
57
|
}
|
|
@@ -71,8 +70,8 @@ export function move_partial_data_to_chain(mut_original, splitConfigutation, lim
|
|
|
71
70
|
return prepared
|
|
72
71
|
.map(([key, value]) => {
|
|
73
72
|
switch (key) {
|
|
74
|
-
case
|
|
75
|
-
case
|
|
73
|
+
case 'content':
|
|
74
|
+
case 'description':
|
|
76
75
|
return [
|
|
77
76
|
key,
|
|
78
77
|
(() => {
|
|
@@ -82,7 +81,7 @@ export function move_partial_data_to_chain(mut_original, splitConfigutation, lim
|
|
|
82
81
|
let remain_symbols_count = 0;
|
|
83
82
|
let opened_codeblock = null;
|
|
84
83
|
const pull = value;
|
|
85
|
-
const CLOSE_CODEBLOCK =
|
|
84
|
+
const CLOSE_CODEBLOCK = '\n```';
|
|
86
85
|
const close_codeblock_length = CLOSE_CODEBLOCK.length;
|
|
87
86
|
while (pull.length) {
|
|
88
87
|
const { chunk, codeblock_lang } = pull[0];
|
|
@@ -107,14 +106,14 @@ export function move_partial_data_to_chain(mut_original, splitConfigutation, lim
|
|
|
107
106
|
opened_codeblock &&
|
|
108
107
|
chunks_to_shift.unshift(
|
|
109
108
|
// @ts-expect-error
|
|
110
|
-
`\`\`\`${opened_codeblock === DEFAULT ?
|
|
109
|
+
`\`\`\`${opened_codeblock === DEFAULT ? '' : opened_codeblock}\n`);
|
|
111
110
|
return [
|
|
112
111
|
chunks_to_keep.join(separateBy),
|
|
113
112
|
chunks_to_shift.join(separateBy),
|
|
114
113
|
];
|
|
115
114
|
})(),
|
|
116
115
|
];
|
|
117
|
-
case
|
|
116
|
+
case 'fields':
|
|
118
117
|
return [
|
|
119
118
|
key,
|
|
120
119
|
Object.values(Object.groupBy(value, (_value, index) => String(index <
|
|
@@ -153,11 +152,11 @@ export function move_partial_data_to_chain(mut_original, splitConfigutation, lim
|
|
|
153
152
|
from.reactions = undefined;
|
|
154
153
|
to.files = from.files;
|
|
155
154
|
from.files = undefined;
|
|
156
|
-
from.description && (to.description =
|
|
157
|
-
from.content && (to.content =
|
|
155
|
+
from.description && (to.description = '-# (пусто)');
|
|
156
|
+
from.content && (to.content = '-# (пусто)');
|
|
158
157
|
!is_started_as_empty &&
|
|
159
158
|
isEmptyEmbed(from) &&
|
|
160
|
-
(from.description =
|
|
159
|
+
(from.description = '-# (пусто)');
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
162
|
// Решает прецендент когда целью становится сообщение в цепочке у которого есть потомки, и это выясняется только в момент отправки
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/discordjs/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/discordjs/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,OAEvC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Embed, Message, MessageCreateOptions } from 'discord.js';
|
|
2
|
+
import type { APIEmbed } from 'discord-api-types/v10';
|
|
3
|
+
export declare function main_embed_of(message: Message | MessageCreateOptions): Embed | APIEmbed | undefined;
|
|
4
|
+
//# sourceMappingURL=main_embed_of.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main_embed_of.d.ts","sourceRoot":"","sources":["../../src/discordjs/main_embed_of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"main_embed_of.d.ts","sourceRoot":"","sources":["../../src/discordjs/main_embed_of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,KAAK,EAEL,OAAO,EACP,oBAAoB,EACpB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErD,wBAAgB,aAAa,CAC5B,OAAO,EAAE,OAAO,GAAG,oBAAoB,GACrC,KAAK,GAAG,QAAQ,GAAG,SAAS,CAK9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ActionRow, type BaseSelectMenuComponentData, ButtonStyle, ComponentType } from
|
|
1
|
+
import { type ActionRow, type BaseSelectMenuComponentData, ButtonStyle, ComponentType } from 'discord.js';
|
|
2
2
|
interface ButtonConfiguration {
|
|
3
3
|
customId?: string;
|
|
4
4
|
label?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message_components.d.ts","sourceRoot":"","sources":["../../src/discordjs/message_components.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,KAAK,2BAA2B,EAChC,WAAW,EACX,aAAa,EACb,MAAM,YAAY,CAAA;AAOnB,UAAU,mBAAmB;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAA;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,GAAG,SAAS,EAAE,mBAAmB,EAAE;cAT5D,MAAM;YACT,MAAM;YACN,MAAM;eACH,OAAO;UACZ,MAAM;WACJ,WAAW;UACZ,aAAa,CAAC,MAAM;IAW3B;AAED,wBAAgB,uBAAuB,CAAC,EACvC,WAAW,EACX,MAAM,EACN,OAAY,GACZ,EAAE;IACF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAA;CAC9C,OAOA;AAED,KAAK,eAAe,CAAC,CAAC,IAAI;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAA;AAC1E,KAAK,eAAe,CAAC,CAAC,IACnB,eAAe,CAAC,CAAC,CAAC,GAClB,eAAe,CAAC,CAAC,CAAC,EAAE,GACpB,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,GACtB,SAAS,CAAC,GAAG,CAAC,GACd,SAAS,CAAC,GAAG,CAAC,EAAE,CAAA;AAEnB,KAAK,eAAe,CAAC,CAAC,IAAI;IACzB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAA;IAC7B,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;CAChC,EAAE,CAAA;AAGH,wBAAgB,cAAc,CAAC,CAAC,EAC/B,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACvB,eAAe,CAAC,CAAC,CAAC,CA0CpB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonStyle, ComponentType, } from
|
|
1
|
+
import { ButtonStyle, ComponentType, } from 'discord.js';
|
|
2
2
|
const DEFAULTS_FOR_BUTTON = {
|
|
3
3
|
type: ComponentType.Button,
|
|
4
4
|
style: ButtonStyle.Secondary,
|
|
@@ -47,7 +47,7 @@ export function justComponents(state) {
|
|
|
47
47
|
components: row,
|
|
48
48
|
}));
|
|
49
49
|
default:
|
|
50
|
-
throw new TypeError(
|
|
50
|
+
throw new TypeError('Unknown case');
|
|
51
51
|
}
|
|
52
52
|
function isSingleActionRow(component) {
|
|
53
53
|
// @ts-expect-error
|
|
@@ -55,7 +55,7 @@ export function justComponents(state) {
|
|
|
55
55
|
}
|
|
56
56
|
function isSingleComponent(component) {
|
|
57
57
|
// @ts-expect-error
|
|
58
|
-
return
|
|
58
|
+
return 'type' in component;
|
|
59
59
|
}
|
|
60
60
|
function isComponentsFlat(component) {
|
|
61
61
|
return Array.isArray(component) && isSingleComponent(component[0]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message_content_limits.d.ts","sourceRoot":"","sources":["../../src/discordjs/message_content_limits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,eAAO,MAAM,qBAAqB;;;;CAIjC,CAAA;AAED,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,eAAe,EACxB,SAAS,WAA4C,GACnD;IACF,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE;SAAG,GAAG,IAAI,MAAM,OAAO,qBAAqB,CAAC,CAAC,EAAE,MAAM;KAAE,CAAA;CACnE,CAwBA"}
|
|
@@ -3,7 +3,7 @@ export const DiscordContentLimites = {
|
|
|
3
3
|
description: 4096,
|
|
4
4
|
field_count: 25,
|
|
5
5
|
};
|
|
6
|
-
export function diagnosticLimits(payload, watchOnly = [
|
|
6
|
+
export function diagnosticLimits(payload, watchOnly = ['content', 'description', 'field_count']) {
|
|
7
7
|
let watchOnlyLocal = watchOnly;
|
|
8
8
|
!Array.isArray(watchOnlyLocal) && (watchOnlyLocal = [watchOnlyLocal]);
|
|
9
9
|
const diagnostic = watchOnlyLocal.map((field) => [
|
|
@@ -18,11 +18,11 @@ export function diagnosticLimits(payload, watchOnly = ["content", "description",
|
|
|
18
18
|
};
|
|
19
19
|
function exceeding_field(field) {
|
|
20
20
|
switch (field) {
|
|
21
|
-
case
|
|
21
|
+
case 'content':
|
|
22
22
|
return (payload.content?.length ?? 0) - DiscordContentLimites.content;
|
|
23
|
-
case
|
|
23
|
+
case 'description':
|
|
24
24
|
return (payload[field]?.length ?? 0) - DiscordContentLimites[field];
|
|
25
|
-
case
|
|
25
|
+
case 'field_count':
|
|
26
26
|
return (payload.fields?.length ?? 0) - DiscordContentLimites[field];
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type AttachmentBuilder, type ColorResolvable, EmbedBuilder, Message, type MessageCreateOptions, type SendableChannels, User } from
|
|
2
|
-
import { justComponents } from
|
|
3
|
-
import { type MaySplitConfiguration } from
|
|
1
|
+
import { type AttachmentBuilder, type ColorResolvable, EmbedBuilder, Message, type MessageCreateOptions, type SendableChannels, User } from 'discord.js';
|
|
2
|
+
import { justComponents } from './message_components.js';
|
|
3
|
+
import { type MaySplitConfiguration } from './mod.js';
|
|
4
4
|
declare function sendableOf<T extends User | SendableChannels | Message | ({} & {
|
|
5
5
|
channel: SendableChannels;
|
|
6
6
|
}) | ({} & {
|
|
@@ -43,7 +43,7 @@ export interface AdvancedPayload {
|
|
|
43
43
|
files?: AttachmentBuilder[];
|
|
44
44
|
}
|
|
45
45
|
export declare function isEmptyEmbed(embed: {
|
|
46
|
-
[key in keyof EmbedBuilder[
|
|
46
|
+
[key in keyof EmbedBuilder['data']]: unknown;
|
|
47
47
|
}): boolean;
|
|
48
48
|
export declare function createMessage(mut_payload: AdvancedPayload): MessageCreateOptions;
|
|
49
49
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message_lifecycle.d.ts","sourceRoot":"","sources":["../../src/discordjs/message_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,iBAAiB,EAEtB,KAAK,eAAe,EACpB,YAAY,EACZ,OAAO,EACP,KAAK,oBAAoB,EAIzB,KAAK,gBAAgB,EACrB,IAAI,EACJ,MAAM,YAAY,CAAA;AAQnB,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAIN,KAAK,qBAAqB,EAC1B,MAAM,UAAU,CAAA;AAEjB,iBAAS,UAAU,CAClB,CAAC,SACE,IAAI,GACJ,gBAAgB,GAChB,OAAO,GACP,CAAC,EAAE,GAAG;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAAC,GACpC,CAAC,EAAE,GAAG;IAAE,IAAI,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,EAEvE,MAAM,EAAE,CAAC,GACP;IACF,IAAI,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CACzD,CAWA;AAED,MAAM,WAAW,eAAe;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,eAAe,CAAC,EAAE,qBAAqB,CAAA;IACvC,YAAY,CAAC,EAAE,eAAe,CAAA;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;IAC9C,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAC3B;AAED,wBAAgB,YAAY,CAC3B,KAAK,EAAE;KAAG,GAAG,IAAI,MAAM,YAAY,CAAC,MAAM,CAAC,GAAG,OAAO;CAAE,WAmBvD;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,eAAe,wBA8DzD;AAED;;;GAGG;AAEH,wBAAsB,eAAe,CAAC,OAAO,SAAS,OAAO,EAC5D,MAAM,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,EACxC,OAAO,EAAE,eAAe,+BAIxB;AAED,wBAAsB,WAAW,CAAC,OAAO,SAAS,OAAO,EACxD,MAAM,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,EACxC,YAAY,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,EAC9C,WAAW,EAAE,eAAe,GAC1B,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAuG3B"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { BaseInteraction, EmbedBuilder, Message,
|
|
2
|
-
import { chain_map } from
|
|
3
|
-
import { _rob_already_prepared, move_partial_data_to_chain, } from
|
|
4
|
-
import { codeOfEmoji } from
|
|
5
|
-
import { justComponents } from
|
|
6
|
-
import { diagnosticLimits } from
|
|
7
|
-
import { onMessageDelete as ChainLifecycleOnMessageDelete,
|
|
1
|
+
import { BaseInteraction, EmbedBuilder, Message, resolveColor, User, } from 'discord.js';
|
|
2
|
+
import { chain_map } from './chain/map.js';
|
|
3
|
+
import { _rob_already_prepared, move_partial_data_to_chain, } from './chain/move_partial_data_to_chain.js';
|
|
4
|
+
import { codeOfEmoji } from './helpers.js';
|
|
5
|
+
import { justComponents } from './message_components.js';
|
|
6
|
+
import { diagnosticLimits } from './message_content_limits.js';
|
|
7
|
+
import { _chain_child, _chain_parent, onMessageDelete as ChainLifecycleOnMessageDelete, } from './mod.js';
|
|
8
8
|
function sendableOf(target) {
|
|
9
9
|
if (target instanceof User || target.isSendable?.()) {
|
|
10
10
|
return target;
|
|
11
11
|
}
|
|
12
|
-
if (
|
|
12
|
+
if ('channel' in target) {
|
|
13
13
|
return target.channel;
|
|
14
14
|
}
|
|
15
|
-
throw new Error(
|
|
15
|
+
throw new Error('Invalid target');
|
|
16
16
|
}
|
|
17
17
|
export function isEmptyEmbed(embed) {
|
|
18
18
|
const EMBED_PROPERTIES = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
'title',
|
|
20
|
+
'author',
|
|
21
|
+
'thumbnail',
|
|
22
|
+
'description',
|
|
23
|
+
'fields',
|
|
24
|
+
'image',
|
|
25
|
+
'footer',
|
|
26
|
+
'timestamp',
|
|
27
|
+
'video',
|
|
28
28
|
];
|
|
29
29
|
// in isEmptyEmbed context is a good compare
|
|
30
30
|
const isEveryPropertyDefault = EMBED_PROPERTIES.every((key) => Boolean(embed[key]) === false);
|
|
@@ -59,7 +59,7 @@ export function createMessage(mut_payload) {
|
|
|
59
59
|
author,
|
|
60
60
|
thumbnail: thumbnail ? { url: thumbnail } : undefined,
|
|
61
61
|
description,
|
|
62
|
-
color: resolveColor(color ??
|
|
62
|
+
color: resolveColor(color ?? 'Random'),
|
|
63
63
|
fields,
|
|
64
64
|
image: image ? { url: image } : undefined,
|
|
65
65
|
video: video ? { url: video } : undefined,
|
|
@@ -87,7 +87,7 @@ export async function sendMessage(target, message_data, mut_payload) {
|
|
|
87
87
|
(() => {
|
|
88
88
|
const message = target instanceof Message
|
|
89
89
|
? target
|
|
90
|
-
:
|
|
90
|
+
: 'message' in target && target.message;
|
|
91
91
|
if (!message) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
@@ -151,7 +151,9 @@ export async function sendMessage(target, message_data, mut_payload) {
|
|
|
151
151
|
mut_payload.reactions
|
|
152
152
|
.filter(Boolean)
|
|
153
153
|
.filter((react) => !message.reactions?.cache.some((compared) => codeOfEmoji(compared.emoji) === react))
|
|
154
|
-
.forEach((react) =>
|
|
154
|
+
.forEach((react) => {
|
|
155
|
+
message.react(react);
|
|
156
|
+
});
|
|
155
157
|
}
|
|
156
158
|
return message;
|
|
157
159
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './chain/configuration.js';
|
|
2
|
+
export * from './chain/get_chain_array.js';
|
|
3
|
+
export * from './chain/lifecycle.js';
|
|
4
|
+
export * from './chain/map.js';
|
|
5
|
+
export * from './chain/move_partial_data_to_chain.js';
|
|
6
|
+
export * from './helpers.js';
|
|
7
|
+
export * from './main_embed_of.js';
|
|
8
|
+
export * from './message_components.js';
|
|
9
|
+
export * from './message_content_limits.js';
|
|
10
|
+
export * from './message_lifecycle.js';
|
|
11
|
+
export * from './modal.js';
|
|
12
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/discordjs/mod.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uCAAuC,CAAA;AACrD,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './chain/configuration.js';
|
|
2
|
+
export * from './chain/get_chain_array.js';
|
|
3
|
+
export * from './chain/lifecycle.js';
|
|
4
|
+
export * from './chain/map.js';
|
|
5
|
+
export * from './chain/move_partial_data_to_chain.js';
|
|
6
|
+
export * from './helpers.js';
|
|
7
|
+
export * from './main_embed_of.js';
|
|
8
|
+
export * from './message_components.js';
|
|
9
|
+
export * from './message_content_limits.js';
|
|
10
|
+
export * from './message_lifecycle.js';
|
|
11
|
+
export * from './modal.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import
|
|
3
|
-
import { justComponents } from
|
|
1
|
+
import { type ModalSubmitInteraction, type RepliableInteraction } from 'discord.js';
|
|
2
|
+
import type { APIModalInteractionResponseCallbackData } from 'discord-api-types/v10';
|
|
3
|
+
import { justComponents } from './message_components.js';
|
|
4
4
|
export declare function createModal({ title, customId, components, }: {
|
|
5
5
|
title: string;
|
|
6
6
|
customId: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/discordjs/modal.ts"],"names":[],"mappings":"AAEA,OAAO,EAGN,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAKzB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAGxD,wBAAgB,WAAW,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,UAAU,GACV,EAAE;IACF,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;CAChD,GAAG,uCAAuC,CAM1C;AAED,wBAAsB,iBAAiB,CAAC,EACvC,KAAK,EACL,QAAkB,EAClB,UAAU,EAAE,WAAW,EACvB,WAAW,EACX,MAAc,GACd,EAAE;IACF,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;IAChD,WAAW,EAAE,OAAO,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAA;IAClE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACzB;;;GAsCA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { justComponents } from
|
|
4
|
-
import { justSendMessage } from
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { ComponentType, ModalBuilder, TextInputStyle, } from 'discord.js';
|
|
3
|
+
import { justComponents } from './message_components.js';
|
|
4
|
+
import { justSendMessage } from './message_lifecycle.js';
|
|
5
5
|
export function createModal({ title, customId, components, }) {
|
|
6
6
|
return new ModalBuilder({
|
|
7
7
|
title,
|
|
@@ -9,8 +9,8 @@ export function createModal({ title, customId, components, }) {
|
|
|
9
9
|
components: justComponents(components),
|
|
10
10
|
}).toJSON();
|
|
11
11
|
}
|
|
12
|
-
export async function justModalQuestion({ title, customId =
|
|
13
|
-
assert(!(
|
|
12
|
+
export async function justModalQuestion({ title, customId = 'modal', components: _components, interaction, thanks = false, }) {
|
|
13
|
+
assert(!('type' in _components && _components.type === ComponentType.ActionRow));
|
|
14
14
|
!Array.isArray(_components) && (_components = [_components]);
|
|
15
15
|
const components = _components.map(
|
|
16
16
|
// @ts-expect-error
|
|
@@ -35,7 +35,7 @@ export async function justModalQuestion({ title, customId = "modal", components:
|
|
|
35
35
|
thanks &&
|
|
36
36
|
response &&
|
|
37
37
|
justSendMessage(response, {
|
|
38
|
-
content: thanks !== true ? thanks :
|
|
38
|
+
content: thanks !== true ? thanks : 'Спасибо!',
|
|
39
39
|
ephemeral: true,
|
|
40
40
|
});
|
|
41
41
|
return { response, fields: response?.fields.fields };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './Accumulator/index.js';
|
|
2
|
+
export * from './lazy/index.js';
|
|
3
|
+
export * from './objectives/mod.js';
|
|
4
|
+
export * from './objectToStrings/index.js';
|
|
5
|
+
export * from './primitives/mod.js';
|
|
6
|
+
export * from './useLazy/index.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lazy/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,CAGrD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChildProcessWithoutNullStreams } from
|
|
2
|
-
import EventsEmitter from
|
|
1
|
+
import type { ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
2
|
+
import EventsEmitter from 'node:events';
|
|
3
3
|
interface IContext {
|
|
4
4
|
exitter: {
|
|
5
5
|
resolve: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getChildProcessUtils.d.ts","sourceRoot":"","sources":["../../src/nodejs/getChildProcessUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAA;AAExE,OAAO,aAAa,MAAM,aAAa,CAAA;AAEvC,UAAU,QAAQ;IACjB,OAAO,EAAE;QAAE,OAAO,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,CAAA;IACtC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IACzB,KAAK,EAAE,8BAA8B,CAAA;IACrC,OAAO,EAAE,aAAa,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,OAAO;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;CAChB;yBAEe,kBAA0B,OAAO;mBAgE1B,MAAM,UAAU,MAAM,EAAE;gBAF3B,MAAM;;;AA9D1B,wBAiHC"}
|