xernerx 4.17.6 → 4.17.9
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/build/XernerxContextCommand.d.ts +47 -75
- package/dist/build/XernerxContextCommand.js +115 -119
- package/dist/build/XernerxEvent.d.ts +10 -10
- package/dist/build/XernerxEvent.js +17 -17
- package/dist/build/XernerxInhibitor.d.ts +15 -39
- package/dist/build/XernerxInhibitor.js +18 -18
- package/dist/build/XernerxMessageCommand.d.ts +52 -78
- package/dist/build/XernerxMessageCommand.js +114 -118
- package/dist/build/XernerxSlashCommand.d.ts +63 -97
- package/dist/build/XernerxSlashCommand.js +173 -177
- package/dist/client/XernerxClient.d.ts +55 -61
- package/dist/client/XernerxClient.js +94 -91
- package/dist/client/XernerxShardClient.d.ts +14 -14
- package/dist/client/XernerxShardClient.js +48 -61
- package/dist/functions/deploy.js +52 -45
- package/dist/functions/load.js +29 -28
- package/dist/functions/reload.js +24 -23
- package/dist/functions/setPresence.d.ts +1 -1
- package/dist/functions/setPresence.js +16 -17
- package/dist/handlers/CommandHandler.d.ts +10 -10
- package/dist/handlers/CommandHandler.js +337 -312
- package/dist/handlers/EventHandler.d.ts +5 -3
- package/dist/handlers/EventHandler.js +76 -48
- package/dist/handlers/ExtensionHandler.d.ts +3 -3
- package/dist/handlers/ExtensionHandler.js +23 -23
- package/dist/handlers/Handler.d.ts +17 -22
- package/dist/handlers/Handler.js +57 -45
- package/dist/handlers/InhibitorHandler.d.ts +3 -3
- package/dist/handlers/InhibitorHandler.js +23 -25
- package/dist/handlers/IntegrationHandler.d.ts +6 -6
- package/dist/handlers/IntegrationHandler.js +20 -20
- package/dist/main.d.ts +22 -29
- package/dist/main.js +22 -29
- package/dist/models/Arguments.d.ts +1 -4
- package/dist/models/Arguments.js +149 -134
- package/dist/models/Cooldowns.d.ts +6 -6
- package/dist/models/Cooldowns.js +29 -25
- package/dist/models/XernerxEntitlement.d.ts +45 -0
- package/dist/models/XernerxEntitlement.js +57 -0
- package/dist/models/XernerxUser.d.ts +14 -0
- package/dist/models/XernerxUser.js +13 -0
- package/dist/tools/XernerxError.d.ts +4 -4
- package/dist/tools/XernerxError.js +8 -8
- package/dist/tools/XernerxIntents.d.ts +2 -2
- package/dist/tools/XernerxIntents.js +21 -21
- package/dist/tools/XernerxLog.d.ts +25 -25
- package/dist/tools/XernerxLog.js +131 -140
- package/dist/tools/XernerxText.d.ts +23 -23
- package/dist/tools/XernerxText.js +89 -79
- package/dist/types/extenders.d.ts +47 -55
- package/dist/types/interfaces.d.ts +190 -195
- package/dist/types/types.d.ts +5 -104
- package/dist/utils/ClientUtil.d.ts +10 -12
- package/dist/utils/ClientUtil.js +117 -96
- package/dist/utils/InteractionUtil.d.ts +13 -13
- package/dist/utils/InteractionUtil.js +147 -148
- package/dist/utils/MessageUtil.d.ts +14 -14
- package/dist/utils/MessageUtil.js +161 -162
- package/dist/utils/Util.d.ts +7 -7
- package/dist/utils/Util.js +7 -7
- package/dist/validators/commandValidation.d.ts +1 -4
- package/dist/validators/commandValidation.js +114 -157
- package/dist/validators/inhibitorValidations.d.ts +2 -21
- package/dist/validators/inhibitorValidations.js +39 -39
- package/package.json +6 -5
- package/tsup.config.ts +19 -0
- package/dist/functions/xernerxUser.d.ts +0 -4
- package/dist/functions/xernerxUser.js +0 -10
|
@@ -3,29 +3,29 @@ import XernerxError from './XernerxError.js';
|
|
|
3
3
|
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
import { XernerxClientType } from '../types/extenders.js';
|
|
5
5
|
export default class XernerxLog {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
6
|
+
private readonly client;
|
|
7
|
+
private readonly errorLog;
|
|
8
|
+
private readonly infoLog;
|
|
9
|
+
private readonly warnLog;
|
|
10
|
+
private readonly readyLog;
|
|
11
|
+
private readonly tableLog;
|
|
12
|
+
private readonly format;
|
|
13
|
+
private readonly time;
|
|
14
|
+
private readonly ram;
|
|
15
|
+
private shard;
|
|
16
|
+
private readonly base;
|
|
17
|
+
constructor(client: XernerxClient | XernerxClientType | true);
|
|
18
|
+
info(message: string, force?: boolean): void | null;
|
|
19
|
+
warn(message: string): void | null;
|
|
20
|
+
debug(message: string): void;
|
|
21
|
+
update(version: string, url: string): Promise<void>;
|
|
22
|
+
error(message: string, error?: XernerxError | unknown): void | null;
|
|
23
|
+
ready(): void;
|
|
24
|
+
private cyan;
|
|
25
|
+
private blue;
|
|
26
|
+
private yellow;
|
|
27
|
+
private purple;
|
|
28
|
+
private red;
|
|
29
|
+
private green;
|
|
30
|
+
private turquoise;
|
|
31
31
|
}
|
package/dist/tools/XernerxLog.js
CHANGED
|
@@ -1,148 +1,139 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
import { Style } from 'dumfunctions';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
|
-
import Discord from 'discord.js';
|
|
4
|
+
import * as Discord from 'discord.js';
|
|
5
5
|
import { version } from '../main.js';
|
|
6
6
|
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
|
|
7
7
|
let i = 0;
|
|
8
8
|
export default class XernerxLog {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
red(string) {
|
|
140
|
-
return Style.log(String(string), { color: Style.TextColor.Red });
|
|
141
|
-
}
|
|
142
|
-
green(string) {
|
|
143
|
-
return Style.log(String(string), { color: Style.TextColor.Green });
|
|
144
|
-
}
|
|
145
|
-
turquoise(string) {
|
|
146
|
-
return Style.log(String(string), { color: Style.TextColor.Turquoise });
|
|
147
|
-
}
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
if (client == true || (typeof client.settings.log == 'boolean' && client.settings.log)) {
|
|
12
|
+
this.errorLog = true;
|
|
13
|
+
this.infoLog = true;
|
|
14
|
+
this.warnLog = true;
|
|
15
|
+
this.format = ['ram', 'time'];
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this.errorLog = client.settings.log?.error;
|
|
19
|
+
this.infoLog = client.settings.log?.info;
|
|
20
|
+
this.warnLog = client.settings.log?.warn;
|
|
21
|
+
this.readyLog = client.settings.log?.ready;
|
|
22
|
+
this.tableLog = client.settings.log?.table;
|
|
23
|
+
this.format = client.settings.log?.format || ['ram', 'time'];
|
|
24
|
+
}
|
|
25
|
+
const format = {
|
|
26
|
+
name: this.blue(pkg.name),
|
|
27
|
+
node: this.green(process.version),
|
|
28
|
+
xernerx: this.cyan(version),
|
|
29
|
+
discordjs: this.cyan(Discord.version),
|
|
30
|
+
platform: this.green(process.platform),
|
|
31
|
+
time: () => this.cyan(new Date().toLocaleTimeString()),
|
|
32
|
+
date: () => this.cyan(new Date().toLocaleDateString()),
|
|
33
|
+
ram: () => `${this.cyan(Math.round(process.memoryUsage().rss / 1000000))}mb`,
|
|
34
|
+
version: this.cyan(pkg.version),
|
|
35
|
+
author: this.blue(pkg.author),
|
|
36
|
+
shard: this.cyan(''),
|
|
37
|
+
index: () => {
|
|
38
|
+
i++;
|
|
39
|
+
return i;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
process.on('message', (message) => {
|
|
43
|
+
if (message.type == 'xernerx')
|
|
44
|
+
format.shard = message?.data?.sharded ? `| ${message?.data?.shardId} |` : '';
|
|
45
|
+
});
|
|
46
|
+
this.base = (type, message) => `${type == 'info'
|
|
47
|
+
? `✔️ | ${this.purple('Xernerx')}`
|
|
48
|
+
: type == `error`
|
|
49
|
+
? `❗ | ${this.red('Xernerx')}`
|
|
50
|
+
: type == `update`
|
|
51
|
+
? `⬆️ | ${this.blue('Xernerx')}`
|
|
52
|
+
: type == `debug`
|
|
53
|
+
? `🐛 | ${this.turquoise('Xernerx')}`
|
|
54
|
+
: `⚠️ | ${this.yellow('Xernerx')}`} | ${this.format
|
|
55
|
+
?.map((c) => (typeof format[c] == 'function' ? format[c]() : format[c]) || null)
|
|
56
|
+
.filter((x) => x)
|
|
57
|
+
.join(' | ')} | ${message}`;
|
|
58
|
+
}
|
|
59
|
+
info(message, force = false) {
|
|
60
|
+
return this.infoLog || force ? console.info(this.base('info', message)) : null;
|
|
61
|
+
}
|
|
62
|
+
warn(message) {
|
|
63
|
+
return this.warnLog ? console.warn(this.base('warn', message)) : null;
|
|
64
|
+
}
|
|
65
|
+
debug(message) {
|
|
66
|
+
return console.debug(this.base('debug', message));
|
|
67
|
+
}
|
|
68
|
+
async update(version, url) {
|
|
69
|
+
try {
|
|
70
|
+
const pkg = await fetch(url)
|
|
71
|
+
.then(async (res) => await res.json())
|
|
72
|
+
.catch(() => ({ version }));
|
|
73
|
+
if (version !== pkg.version)
|
|
74
|
+
console.info(this.base('update', `A new version for ${pkg.name} is available, you're using version ${this.cyan(version)}, new version is ${this.cyan(pkg.version)}, run ${Style.log(`npm i ${pkg.name}@${pkg.version}`, {
|
|
75
|
+
color: Style.BackgroundColor.Grey,
|
|
76
|
+
})} to update to the latest version.`));
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
console.warn(this.base('error', `An error occured while trying to check for a new version for ${pkg.name}, please try again later.`));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
error(message, error) {
|
|
83
|
+
return this.errorLog ? console.error(this.base('error', message), error || '') : null;
|
|
84
|
+
}
|
|
85
|
+
ready() {
|
|
86
|
+
if (typeof this.client == 'boolean')
|
|
87
|
+
return;
|
|
88
|
+
const client = this.client;
|
|
89
|
+
// @ts-ignore
|
|
90
|
+
this.client.prependOnceListener('ready', async (synced) => {
|
|
91
|
+
this.info(`${Style.log(synced.user.tag, { color: Style.TextColor.Blue })} is now ${this.green('online')}, watching ${this.cyan(String(client.guilds.cache.size))} guild${client.guilds.cache.size > 1 ? 's' : ''}, using ${client.settings.local ? this.blue((await client.guilds.fetch(client.settings.local))?.name) : 'none'} as local guild.`, this.readyLog);
|
|
92
|
+
const files = [];
|
|
93
|
+
for (const [id, data] of client.commands.message) {
|
|
94
|
+
files.push(data);
|
|
95
|
+
id;
|
|
96
|
+
}
|
|
97
|
+
for (const [id, data] of client.commands.slash) {
|
|
98
|
+
files.push(data);
|
|
99
|
+
id;
|
|
100
|
+
}
|
|
101
|
+
for (const [id, data] of client.commands.context) {
|
|
102
|
+
files.push(data);
|
|
103
|
+
id;
|
|
104
|
+
}
|
|
105
|
+
for (const [id, data] of client.events) {
|
|
106
|
+
files.push(data);
|
|
107
|
+
id;
|
|
108
|
+
}
|
|
109
|
+
for (const [id, data] of client.inhibitors) {
|
|
110
|
+
files.push(data);
|
|
111
|
+
id;
|
|
112
|
+
}
|
|
113
|
+
if (this.tableLog) {
|
|
114
|
+
console.table(files, this.tableLog);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
cyan(string) {
|
|
119
|
+
return Style.log(String(string), { color: Style.TextColor.Cyan });
|
|
120
|
+
}
|
|
121
|
+
blue(string) {
|
|
122
|
+
return Style.log(String(string), { color: Style.TextColor.Blue });
|
|
123
|
+
}
|
|
124
|
+
yellow(string) {
|
|
125
|
+
return Style.log(String(string), { color: Style.TextColor.Yellow });
|
|
126
|
+
}
|
|
127
|
+
purple(string) {
|
|
128
|
+
return Style.log(String(string), { color: Style.TextColor.Purple });
|
|
129
|
+
}
|
|
130
|
+
red(string) {
|
|
131
|
+
return Style.log(String(string), { color: Style.TextColor.Red });
|
|
132
|
+
}
|
|
133
|
+
green(string) {
|
|
134
|
+
return Style.log(String(string), { color: Style.TextColor.Green });
|
|
135
|
+
}
|
|
136
|
+
turquoise(string) {
|
|
137
|
+
return Style.log(String(string), { color: Style.TextColor.Turquoise });
|
|
138
|
+
}
|
|
148
139
|
}
|
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
import { Emoji, Role } from 'discord.js';
|
|
3
3
|
import { XernerxGuildChannel, XernerxMember, XernerxUser } from '../types/extenders.js';
|
|
4
4
|
export default class XernerxText {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
user(user: string | XernerxUser): string;
|
|
6
|
+
channel(channel: string | XernerxGuildChannel): string;
|
|
7
|
+
role(role: string | Role): string;
|
|
8
|
+
emoji(emoji: string | Emoji, animated?: boolean): string;
|
|
9
|
+
member(member: string | XernerxMember): string;
|
|
10
|
+
command(id: string, name: string): string | null;
|
|
11
|
+
timestamp(timestamp?: number | Date, format?: 't' | 'T' | 'd' | 'D' | 'f' | 'F' | 'R'): string;
|
|
12
|
+
codeBlock(code: string, language: string): string;
|
|
13
|
+
iCodeBlock(code: string): string;
|
|
14
|
+
bold(text: string): string;
|
|
15
|
+
italic(text: string): string;
|
|
16
|
+
underline(text: string): string;
|
|
17
|
+
strike(text: string): string;
|
|
18
|
+
spoiler(text: string): string;
|
|
19
|
+
quote(text: string): string;
|
|
20
|
+
blockQuote(text: string): string;
|
|
21
|
+
hyperlink(text: string, url: string): string;
|
|
22
|
+
Progressbar(min: number, max: number, cur: number, options?: ProgressBarOptions): string;
|
|
23
23
|
}
|
|
24
24
|
interface ProgressBarOptions {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
fill?: string;
|
|
26
|
+
fade?: string;
|
|
27
|
+
empty?: string;
|
|
28
|
+
percentage?: boolean;
|
|
29
|
+
length?: number;
|
|
30
30
|
}
|
|
31
31
|
export {};
|
|
@@ -1,84 +1,94 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
export default class XernerxText {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
3
|
+
user(user) {
|
|
4
|
+
if (typeof user == 'object')
|
|
5
|
+
user = user.id;
|
|
6
|
+
return `<@${user}>`;
|
|
7
|
+
}
|
|
8
|
+
channel(channel) {
|
|
9
|
+
if (typeof channel == 'object')
|
|
10
|
+
channel = channel.id;
|
|
11
|
+
return `<#${channel}>`;
|
|
12
|
+
}
|
|
13
|
+
role(role) {
|
|
14
|
+
if (typeof role == 'object')
|
|
15
|
+
role = role.id;
|
|
16
|
+
return `<@&${role}>`;
|
|
17
|
+
}
|
|
18
|
+
emoji(emoji, animated = false) {
|
|
19
|
+
if (typeof emoji == 'object')
|
|
20
|
+
emoji = emoji.id;
|
|
21
|
+
return `<${animated ? 'a' : ''}:${emoji}>`;
|
|
22
|
+
}
|
|
23
|
+
member(member) {
|
|
24
|
+
if (typeof member == 'object')
|
|
25
|
+
member = member.id;
|
|
26
|
+
return `<@!${member}>`;
|
|
27
|
+
}
|
|
28
|
+
command(id, name) {
|
|
29
|
+
if (typeof id !== 'string')
|
|
30
|
+
return null;
|
|
31
|
+
return `</${name}:${id}>`;
|
|
32
|
+
}
|
|
33
|
+
timestamp(timestamp = Date.now(), format = 'R') {
|
|
34
|
+
if (typeof timestamp == 'string')
|
|
35
|
+
timestamp = Number(timestamp);
|
|
36
|
+
if (isNaN(timestamp))
|
|
37
|
+
return 'Invalid Date';
|
|
38
|
+
return `<t:${timestamp}:${format}>`;
|
|
39
|
+
}
|
|
40
|
+
codeBlock(code, language) {
|
|
41
|
+
return `\`\`\`${language}
|
|
34
42
|
${code}
|
|
35
43
|
\`\`\``;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
44
|
+
}
|
|
45
|
+
iCodeBlock(code) {
|
|
46
|
+
return `\`${code}\``;
|
|
47
|
+
}
|
|
48
|
+
bold(text) {
|
|
49
|
+
return `**${text}**`;
|
|
50
|
+
}
|
|
51
|
+
italic(text) {
|
|
52
|
+
return `*${text}*`;
|
|
53
|
+
}
|
|
54
|
+
underline(text) {
|
|
55
|
+
return `__${text}__`;
|
|
56
|
+
}
|
|
57
|
+
strike(text) {
|
|
58
|
+
return `~~${text}~~`;
|
|
59
|
+
}
|
|
60
|
+
spoiler(text) {
|
|
61
|
+
return `||${text}||`;
|
|
62
|
+
}
|
|
63
|
+
quote(text) {
|
|
64
|
+
return `> ${text}`;
|
|
65
|
+
}
|
|
66
|
+
blockQuote(text) {
|
|
67
|
+
return `>>> ${text}`;
|
|
68
|
+
}
|
|
69
|
+
hyperlink(text, url) {
|
|
70
|
+
return `[${text}](${url})`;
|
|
71
|
+
}
|
|
72
|
+
// public static HyperlinkWithTooltip(text: string, url: string, tooltip: string) {
|
|
73
|
+
// return `[${text}](${url} "${tooltip}")`;
|
|
74
|
+
// }
|
|
75
|
+
// public static HyperlinkWithTooltipAndImage(text: string, url: string, tooltip: string, imageUrl: string) {
|
|
76
|
+
// return `[${text}](${url} "${tooltip}":${imageUrl})`;
|
|
77
|
+
// }
|
|
78
|
+
// public static HyperlinkWithImage(text: string, url: string, imageUrl: string) {
|
|
79
|
+
// return `[${text}](${url}:${imageUrl})`;
|
|
80
|
+
// }
|
|
81
|
+
Progressbar(min, max, cur, options = {}) {
|
|
82
|
+
if (!options.fill)
|
|
83
|
+
options.fill = '█';
|
|
84
|
+
if (!options.fade)
|
|
85
|
+
options.fade = '▓▒';
|
|
86
|
+
if (!options.empty)
|
|
87
|
+
options.empty = '░';
|
|
88
|
+
const length = options.length || 20, percentage = cur / max, filledLength = Math.round(length * percentage), emptyLength = length - filledLength;
|
|
89
|
+
if (!options.percentage)
|
|
90
|
+
return '`' + options.fill.repeat(filledLength) + options.empty.repeat(emptyLength) + '`';
|
|
91
|
+
else
|
|
92
|
+
return '`' + options.fill.repeat(filledLength) + options.empty.repeat(emptyLength) + '` ' + `\`${percentage * 100}%\``;
|
|
93
|
+
}
|
|
84
94
|
}
|