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