zumito-framework 1.1.41 → 1.1.43
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/index.d.ts +12 -10
- package/dist/index.js +7 -5
- package/dist/utils/EmojiFallback.d.ts +4 -0
- package/dist/utils/EmojiFallback.js +6 -0
- package/dist/utils/TextFormatter.d.ts +26 -0
- package/dist/utils/TextFormatter.js +79 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FrameworkSettings } from './types/FrameworkSettings.js';
|
|
1
|
+
import { ApiResponse } from './definitions/ApiResponse.js';
|
|
3
2
|
import { Command } from './types/Command.js';
|
|
4
|
-
import {
|
|
5
|
-
import { CommandParameters } from './types/CommandParameters.js';
|
|
3
|
+
import { CommandArgDefinition } from './types/CommandArgDefinition.js';
|
|
6
4
|
import { CommandArguments } from './types/CommandArguments.js';
|
|
5
|
+
import { CommandChoiceDefinition } from './types/CommandChoiceDefinition.js';
|
|
6
|
+
import { CommandParameters } from './types/CommandParameters.js';
|
|
7
|
+
import { CommandType } from './types/CommandType.js';
|
|
7
8
|
import { FrameworkEvent } from './types/FrameworkEvent.js';
|
|
9
|
+
import { FrameworkSettings } from './types/FrameworkSettings.js';
|
|
10
|
+
import { Module } from './types/Module.js';
|
|
11
|
+
import { SelectMenuParameters } from './types/SelectMenuParameters.js';
|
|
12
|
+
import { TextFormatter } from './utils/TextFormatter.js';
|
|
8
13
|
import { Translation } from './types/Translation.js';
|
|
9
14
|
import { TranslationManager } from './TranslationManager.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
import { CommandArgDefinition } from './types/CommandArgDefinition.js';
|
|
14
|
-
import { CommandChoiceDefinition } from './types/CommandChoiceDefinition.js';
|
|
15
|
-
export { ZumitoFramework, FrameworkSettings, Command, Module, CommandParameters, CommandArguments, FrameworkEvent, Translation, TranslationManager, ApiResponse, SelectMenuParameters, CommandType, CommandArgDefinition, CommandChoiceDefinition };
|
|
15
|
+
import { ZumitoFramework } from './ZumitoFramework.js';
|
|
16
|
+
import { EmojiFallback } from './utils/EmojiFallback.js';
|
|
17
|
+
export { ZumitoFramework, FrameworkSettings, Command, Module, CommandParameters, CommandArguments, FrameworkEvent, Translation, TranslationManager, ApiResponse, SelectMenuParameters, CommandType, CommandArgDefinition, CommandChoiceDefinition, TextFormatter, EmojiFallback };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiResponse } from './definitions/ApiResponse.js';
|
|
2
2
|
import { Command } from './types/Command.js';
|
|
3
|
-
import { Module } from './types/Module.js';
|
|
4
3
|
import { CommandArguments } from './types/CommandArguments.js';
|
|
4
|
+
import { CommandType } from './types/CommandType.js';
|
|
5
5
|
import { FrameworkEvent } from './types/FrameworkEvent.js';
|
|
6
|
+
import { Module } from './types/Module.js';
|
|
7
|
+
import { TextFormatter } from './utils/TextFormatter.js';
|
|
6
8
|
import { Translation } from './types/Translation.js';
|
|
7
9
|
import { TranslationManager } from './TranslationManager.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
export { ZumitoFramework, Command, Module, CommandArguments, FrameworkEvent, Translation, TranslationManager, ApiResponse, CommandType };
|
|
10
|
+
import { ZumitoFramework } from './ZumitoFramework.js';
|
|
11
|
+
import { EmojiFallback } from './utils/EmojiFallback.js';
|
|
12
|
+
export { ZumitoFramework, Command, Module, CommandArguments, FrameworkEvent, Translation, TranslationManager, ApiResponse, CommandType, TextFormatter, EmojiFallback };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare class TextFormatter {
|
|
2
|
+
static getUser(userId: string): string;
|
|
3
|
+
static getChannel(channelId: string): string;
|
|
4
|
+
static getRole(roleId: string): string;
|
|
5
|
+
static getEmoji(emojiId: string): string;
|
|
6
|
+
static getEmojiAnimated(emojiId: string): string;
|
|
7
|
+
static getMember(memberId: string): string;
|
|
8
|
+
static getTimestamp(timestamp: number, format: string): string;
|
|
9
|
+
static getTimestampFromDate(date: Date, format: string): string;
|
|
10
|
+
static getTimestampFromNow(format: string): string;
|
|
11
|
+
static getCodeBlock(code: string, language: string): string;
|
|
12
|
+
static getInlineCodeBlock(code: string): string;
|
|
13
|
+
static getBold(text: string): string;
|
|
14
|
+
static getItalic(text: string): string;
|
|
15
|
+
static getUnderline(text: string): string;
|
|
16
|
+
static getStrikethrough(text: string): string;
|
|
17
|
+
static getSpoiler(text: string): string;
|
|
18
|
+
static getQuote(text: string): string;
|
|
19
|
+
static getBlockQuote(text: string): string;
|
|
20
|
+
static getHyperlink(text: string, url: string): string;
|
|
21
|
+
static getHyperlinkWithTooltip(text: string, url: string, tooltip: string): string;
|
|
22
|
+
static getHyperlinkWithTooltipAndImage(text: string, url: string, tooltip: string, imageUrl: string): string;
|
|
23
|
+
static getHyperlinkWithImage(text: string, url: string, imageUrl: string): string;
|
|
24
|
+
static getProgressbar(progress: number, max: number, length: number, filled: string, empty: string): string;
|
|
25
|
+
static getProgressbarWithText(progress: number, max: number, length: number, filled: string, empty: string, text: string): string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export class TextFormatter {
|
|
2
|
+
static getUser(userId) {
|
|
3
|
+
return `<@${userId}>`;
|
|
4
|
+
}
|
|
5
|
+
static getChannel(channelId) {
|
|
6
|
+
return `<#${channelId}>`;
|
|
7
|
+
}
|
|
8
|
+
static getRole(roleId) {
|
|
9
|
+
return `<@&${roleId}>`;
|
|
10
|
+
}
|
|
11
|
+
static getEmoji(emojiId) {
|
|
12
|
+
return `<:${emojiId}>`;
|
|
13
|
+
}
|
|
14
|
+
static getEmojiAnimated(emojiId) {
|
|
15
|
+
return `<a:${emojiId}>`;
|
|
16
|
+
}
|
|
17
|
+
static getMember(memberId) {
|
|
18
|
+
return `<@!${memberId}>`;
|
|
19
|
+
}
|
|
20
|
+
static getTimestamp(timestamp, format) {
|
|
21
|
+
return `<t:${timestamp}:${format}>`;
|
|
22
|
+
}
|
|
23
|
+
static getTimestampFromDate(date, format) {
|
|
24
|
+
return `<t:${date.getTime() / 1000}:${format}>`;
|
|
25
|
+
}
|
|
26
|
+
static getTimestampFromNow(format) {
|
|
27
|
+
return `<t:${Math.floor(Date.now() / 1000)}:${format}>`;
|
|
28
|
+
}
|
|
29
|
+
static getCodeBlock(code, language) {
|
|
30
|
+
return `\`\`\`${language}
|
|
31
|
+
${code}
|
|
32
|
+
\`\`\``;
|
|
33
|
+
}
|
|
34
|
+
static getInlineCodeBlock(code) {
|
|
35
|
+
return `\`${code}\``;
|
|
36
|
+
}
|
|
37
|
+
static getBold(text) {
|
|
38
|
+
return `**${text}**`;
|
|
39
|
+
}
|
|
40
|
+
static getItalic(text) {
|
|
41
|
+
return `*${text}*`;
|
|
42
|
+
}
|
|
43
|
+
static getUnderline(text) {
|
|
44
|
+
return `__${text}__`;
|
|
45
|
+
}
|
|
46
|
+
static getStrikethrough(text) {
|
|
47
|
+
return `~~${text}~~`;
|
|
48
|
+
}
|
|
49
|
+
static getSpoiler(text) {
|
|
50
|
+
return `||${text}||`;
|
|
51
|
+
}
|
|
52
|
+
static getQuote(text) {
|
|
53
|
+
return `> ${text}`;
|
|
54
|
+
}
|
|
55
|
+
static getBlockQuote(text) {
|
|
56
|
+
return `>>> ${text}`;
|
|
57
|
+
}
|
|
58
|
+
static getHyperlink(text, url) {
|
|
59
|
+
return `[${text}](${url})`;
|
|
60
|
+
}
|
|
61
|
+
static getHyperlinkWithTooltip(text, url, tooltip) {
|
|
62
|
+
return `[${text}](${url} "${tooltip}")`;
|
|
63
|
+
}
|
|
64
|
+
static getHyperlinkWithTooltipAndImage(text, url, tooltip, imageUrl) {
|
|
65
|
+
return `[${text}](${url} "${tooltip}":${imageUrl})`;
|
|
66
|
+
}
|
|
67
|
+
static getHyperlinkWithImage(text, url, imageUrl) {
|
|
68
|
+
return `[${text}](${url}:${imageUrl})`;
|
|
69
|
+
}
|
|
70
|
+
static getProgressbar(progress, max, length, filled, empty) {
|
|
71
|
+
const percentage = progress / max;
|
|
72
|
+
const filledLength = Math.round(length * percentage);
|
|
73
|
+
const emptyLength = length - filledLength;
|
|
74
|
+
return filled.repeat(filledLength) + empty.repeat(emptyLength);
|
|
75
|
+
}
|
|
76
|
+
static getProgressbarWithText(progress, max, length, filled, empty, text) {
|
|
77
|
+
return `${this.getProgressbar(progress, max, length, filled, empty)} ${text}`;
|
|
78
|
+
}
|
|
79
|
+
}
|