seyfert 0.1.0
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/LICENSE +190 -0
- package/README.md +57 -0
- package/lib/api/CDN.d.ts +220 -0
- package/lib/api/CDN.js +236 -0
- package/lib/api/REST.d.ts +127 -0
- package/lib/api/REST.js +424 -0
- package/lib/api/Router.d.ts +17 -0
- package/lib/api/Router.js +63 -0
- package/lib/api/Routes/applications.d.ts +46 -0
- package/lib/api/Routes/applications.js +2 -0
- package/lib/api/Routes/cdn.d.ts +66 -0
- package/lib/api/Routes/cdn.js +2 -0
- package/lib/api/Routes/channels.d.ts +109 -0
- package/lib/api/Routes/channels.js +2 -0
- package/lib/api/Routes/gateway.d.ts +11 -0
- package/lib/api/Routes/gateway.js +2 -0
- package/lib/api/Routes/guilds.d.ts +171 -0
- package/lib/api/Routes/guilds.js +2 -0
- package/lib/api/Routes/index.d.ts +13 -0
- package/lib/api/Routes/index.js +17 -0
- package/lib/api/Routes/interactions.d.ts +14 -0
- package/lib/api/Routes/interactions.js +2 -0
- package/lib/api/Routes/invites.d.ts +9 -0
- package/lib/api/Routes/invites.js +2 -0
- package/lib/api/Routes/stage-instances.d.ts +13 -0
- package/lib/api/Routes/stage-instances.js +2 -0
- package/lib/api/Routes/stickers.d.ts +11 -0
- package/lib/api/Routes/stickers.js +2 -0
- package/lib/api/Routes/users.d.ts +35 -0
- package/lib/api/Routes/users.js +2 -0
- package/lib/api/Routes/voice.d.ts +10 -0
- package/lib/api/Routes/voice.js +2 -0
- package/lib/api/Routes/webhooks.d.ts +29 -0
- package/lib/api/Routes/webhooks.js +2 -0
- package/lib/api/errors/DiscordAPIError.d.ts +51 -0
- package/lib/api/errors/DiscordAPIError.js +81 -0
- package/lib/api/errors/HTTPError.d.ts +20 -0
- package/lib/api/errors/HTTPError.js +28 -0
- package/lib/api/errors/RateLimitError.d.ts +19 -0
- package/lib/api/errors/RateLimitError.js +37 -0
- package/lib/api/handlers/BurstHandler.d.ts +51 -0
- package/lib/api/handlers/BurstHandler.js +124 -0
- package/lib/api/handlers/SequentialHandler.d.ts +81 -0
- package/lib/api/handlers/SequentialHandler.js +365 -0
- package/lib/api/handlers/Shared.d.ts +14 -0
- package/lib/api/handlers/Shared.js +125 -0
- package/lib/api/index.d.ts +5 -0
- package/lib/api/index.js +21 -0
- package/lib/api/interfaces/Handler.d.ts +21 -0
- package/lib/api/interfaces/Handler.js +2 -0
- package/lib/api/shared.d.ts +7 -0
- package/lib/api/shared.js +27 -0
- package/lib/api/utils/constants.d.ts +39 -0
- package/lib/api/utils/constants.js +50 -0
- package/lib/api/utils/types.d.ts +335 -0
- package/lib/api/utils/types.js +14 -0
- package/lib/api/utils/utils.d.ts +52 -0
- package/lib/api/utils/utils.js +159 -0
- package/lib/builders/ActionRow.d.ts +40 -0
- package/lib/builders/ActionRow.js +58 -0
- package/lib/builders/Attachment.d.ts +106 -0
- package/lib/builders/Attachment.js +196 -0
- package/lib/builders/Base.d.ts +10 -0
- package/lib/builders/Base.js +13 -0
- package/lib/builders/Button.d.ts +59 -0
- package/lib/builders/Button.js +94 -0
- package/lib/builders/MessageEmbed.d.ts +116 -0
- package/lib/builders/MessageEmbed.js +159 -0
- package/lib/builders/Modal.d.ts +111 -0
- package/lib/builders/Modal.js +162 -0
- package/lib/builders/SelectMenu.d.ts +201 -0
- package/lib/builders/SelectMenu.js +293 -0
- package/lib/builders/index.d.ts +12 -0
- package/lib/builders/index.js +54 -0
- package/lib/builders/types.d.ts +21 -0
- package/lib/builders/types.js +2 -0
- package/lib/cache/adapters/default.d.ts +24 -0
- package/lib/cache/adapters/default.js +118 -0
- package/lib/cache/adapters/index.d.ts +4 -0
- package/lib/cache/adapters/index.js +20 -0
- package/lib/cache/adapters/redis.d.ts +35 -0
- package/lib/cache/adapters/redis.js +180 -0
- package/lib/cache/adapters/types.d.ts +25 -0
- package/lib/cache/adapters/types.js +2 -0
- package/lib/cache/adapters/workeradapter.d.ts +24 -0
- package/lib/cache/adapters/workeradapter.js +76 -0
- package/lib/cache/index.d.ts +97 -0
- package/lib/cache/index.js +394 -0
- package/lib/cache/resources/channels.d.ts +7 -0
- package/lib/cache/resources/channels.js +20 -0
- package/lib/cache/resources/default/base.d.ts +25 -0
- package/lib/cache/resources/default/base.js +75 -0
- package/lib/cache/resources/default/guild-based.d.ts +33 -0
- package/lib/cache/resources/default/guild-based.js +91 -0
- package/lib/cache/resources/default/guild-related.d.ts +32 -0
- package/lib/cache/resources/default/guild-related.js +102 -0
- package/lib/cache/resources/emojis.d.ts +7 -0
- package/lib/cache/resources/emojis.js +17 -0
- package/lib/cache/resources/guilds.d.ts +10 -0
- package/lib/cache/resources/guilds.js +117 -0
- package/lib/cache/resources/members.d.ts +10 -0
- package/lib/cache/resources/members.js +41 -0
- package/lib/cache/resources/presence.d.ts +9 -0
- package/lib/cache/resources/presence.js +14 -0
- package/lib/cache/resources/roles.d.ts +7 -0
- package/lib/cache/resources/roles.js +17 -0
- package/lib/cache/resources/stage-instances.d.ts +5 -0
- package/lib/cache/resources/stage-instances.js +8 -0
- package/lib/cache/resources/stickers.d.ts +7 -0
- package/lib/cache/resources/stickers.js +17 -0
- package/lib/cache/resources/threads.d.ts +7 -0
- package/lib/cache/resources/threads.js +17 -0
- package/lib/cache/resources/users.d.ts +7 -0
- package/lib/cache/resources/users.js +17 -0
- package/lib/cache/resources/voice-states.d.ts +9 -0
- package/lib/cache/resources/voice-states.js +13 -0
- package/lib/client/base.d.ts +244 -0
- package/lib/client/base.js +178 -0
- package/lib/client/client.d.ts +32 -0
- package/lib/client/client.js +156 -0
- package/lib/client/httpclient.d.ts +21 -0
- package/lib/client/httpclient.js +143 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +19 -0
- package/lib/client/oninteraction.d.ts +4 -0
- package/lib/client/oninteraction.js +180 -0
- package/lib/client/workerclient.d.ts +28 -0
- package/lib/client/workerclient.js +213 -0
- package/lib/collection.d.ts +233 -0
- package/lib/collection.js +371 -0
- package/lib/commands/applications/chat.d.ts +139 -0
- package/lib/commands/applications/chat.js +173 -0
- package/lib/commands/applications/chatcontext.d.ts +28 -0
- package/lib/commands/applications/chatcontext.js +53 -0
- package/lib/commands/applications/menu.d.ts +39 -0
- package/lib/commands/applications/menu.js +87 -0
- package/lib/commands/applications/menucontext.d.ts +25 -0
- package/lib/commands/applications/menucontext.js +64 -0
- package/lib/commands/applications/options.d.ts +67 -0
- package/lib/commands/applications/options.js +44 -0
- package/lib/commands/applications/shared.d.ts +35 -0
- package/lib/commands/applications/shared.js +2 -0
- package/lib/commands/decorators.d.ts +107 -0
- package/lib/commands/decorators.js +85 -0
- package/lib/commands/handler.d.ts +15 -0
- package/lib/commands/handler.js +140 -0
- package/lib/commands/index.d.ts +8 -0
- package/lib/commands/index.js +24 -0
- package/lib/commands/optionresolver.d.ts +49 -0
- package/lib/commands/optionresolver.js +146 -0
- package/lib/common/bot/watcher.d.ts +53 -0
- package/lib/common/bot/watcher.js +104 -0
- package/lib/common/index.d.ts +13 -0
- package/lib/common/index.js +30 -0
- package/lib/common/it/colors.d.ts +274 -0
- package/lib/common/it/colors.js +453 -0
- package/lib/common/it/constants.d.ts +36 -0
- package/lib/common/it/constants.js +40 -0
- package/lib/common/it/logger.d.ts +114 -0
- package/lib/common/it/logger.js +189 -0
- package/lib/common/it/utils.d.ts +107 -0
- package/lib/common/it/utils.js +275 -0
- package/lib/common/shorters/base.d.ts +5 -0
- package/lib/common/shorters/base.js +10 -0
- package/lib/common/shorters/channels.d.ts +90 -0
- package/lib/common/shorters/channels.js +95 -0
- package/lib/common/shorters/guilds.d.ts +389 -0
- package/lib/common/shorters/guilds.js +350 -0
- package/lib/common/shorters/members.d.ts +115 -0
- package/lib/common/shorters/members.js +179 -0
- package/lib/common/shorters/messages.d.ts +27 -0
- package/lib/common/shorters/messages.js +117 -0
- package/lib/common/shorters/roles.d.ts +12 -0
- package/lib/common/shorters/roles.js +51 -0
- package/lib/common/shorters/templates.d.ts +12 -0
- package/lib/common/shorters/templates.js +29 -0
- package/lib/common/shorters/users.d.ts +11 -0
- package/lib/common/shorters/users.js +42 -0
- package/lib/common/shorters/webhook.d.ts +33 -0
- package/lib/common/shorters/webhook.js +69 -0
- package/lib/common/types/options.d.ts +10 -0
- package/lib/common/types/options.js +2 -0
- package/lib/common/types/resolvables.d.ts +10 -0
- package/lib/common/types/resolvables.js +2 -0
- package/lib/common/types/util.d.ts +90 -0
- package/lib/common/types/util.js +2 -0
- package/lib/common/types/write.d.ts +21 -0
- package/lib/common/types/write.js +2 -0
- package/lib/components/ActionRow.d.ts +10 -0
- package/lib/components/ActionRow.js +13 -0
- package/lib/components/ButtonComponent.d.ts +19 -0
- package/lib/components/ButtonComponent.js +34 -0
- package/lib/components/ChannelSelectMenuComponent.d.ts +6 -0
- package/lib/components/ChannelSelectMenuComponent.js +12 -0
- package/lib/components/MentionableSelectMenuComponent.d.ts +4 -0
- package/lib/components/MentionableSelectMenuComponent.js +7 -0
- package/lib/components/RoleSelectMenuComponent.d.ts +4 -0
- package/lib/components/RoleSelectMenuComponent.js +7 -0
- package/lib/components/StringSelectMenuComponent.d.ts +6 -0
- package/lib/components/StringSelectMenuComponent.js +12 -0
- package/lib/components/TextInputComponent.d.ts +7 -0
- package/lib/components/TextInputComponent.js +14 -0
- package/lib/components/UserSelectMenuComponent.d.ts +4 -0
- package/lib/components/UserSelectMenuComponent.js +7 -0
- package/lib/components/command.d.ts +23 -0
- package/lib/components/command.js +15 -0
- package/lib/components/handler.d.ts +48 -0
- package/lib/components/handler.js +231 -0
- package/lib/components/index.d.ts +20 -0
- package/lib/components/index.js +55 -0
- package/lib/components/listener.d.ts +11 -0
- package/lib/components/listener.js +18 -0
- package/lib/events/event.d.ts +23 -0
- package/lib/events/event.js +2 -0
- package/lib/events/handler.d.ts +19 -0
- package/lib/events/handler.js +112 -0
- package/lib/events/hooks/application_command.d.ts +12 -0
- package/lib/events/hooks/application_command.js +8 -0
- package/lib/events/hooks/auto_moderation.d.ts +22 -0
- package/lib/events/hooks/auto_moderation.js +21 -0
- package/lib/events/hooks/channel.d.ts +11 -0
- package/lib/events/hooks/channel.js +24 -0
- package/lib/events/hooks/custom.d.ts +4 -0
- package/lib/events/hooks/custom.js +11 -0
- package/lib/events/hooks/dispatch.d.ts +5 -0
- package/lib/events/hooks/dispatch.js +12 -0
- package/lib/events/hooks/entitlement.d.ts +35 -0
- package/lib/events/hooks/entitlement.js +16 -0
- package/lib/events/hooks/guild.d.ts +228 -0
- package/lib/events/hooks/guild.js +101 -0
- package/lib/events/hooks/index.d.ts +23 -0
- package/lib/events/hooks/index.js +34 -0
- package/lib/events/hooks/integration.d.ts +94 -0
- package/lib/events/hooks/integration.js +27 -0
- package/lib/events/hooks/interactions.d.ts +4 -0
- package/lib/events/hooks/interactions.js +8 -0
- package/lib/events/hooks/invite.d.ts +21 -0
- package/lib/events/hooks/invite.js +12 -0
- package/lib/events/hooks/message.d.ts +69 -0
- package/lib/events/hooks/message.js +37 -0
- package/lib/events/hooks/presence.d.ts +27 -0
- package/lib/events/hooks/presence.js +8 -0
- package/lib/events/hooks/stage.d.ts +29 -0
- package/lib/events/hooks/stage.js +16 -0
- package/lib/events/hooks/thread.d.ts +198 -0
- package/lib/events/hooks/thread.js +29 -0
- package/lib/events/hooks/typing.d.ts +16 -0
- package/lib/events/hooks/typing.js +14 -0
- package/lib/events/hooks/user.d.ts +4 -0
- package/lib/events/hooks/user.js +8 -0
- package/lib/events/hooks/voice.d.ts +37 -0
- package/lib/events/hooks/voice.js +18 -0
- package/lib/events/hooks/webhook.d.ts +6 -0
- package/lib/events/hooks/webhook.js +8 -0
- package/lib/events/index.d.ts +2 -0
- package/lib/events/index.js +18 -0
- package/lib/index.d.ts +79 -0
- package/lib/index.js +104 -0
- package/lib/langs/handler.d.ts +11 -0
- package/lib/langs/handler.js +34 -0
- package/lib/langs/index.d.ts +2 -0
- package/lib/langs/index.js +18 -0
- package/lib/langs/router.d.ts +18 -0
- package/lib/langs/router.js +42 -0
- package/lib/structures/AnonymousGuild.d.ts +7 -0
- package/lib/structures/AnonymousGuild.js +11 -0
- package/lib/structures/AutoModerationRule.d.ts +22 -0
- package/lib/structures/AutoModerationRule.js +34 -0
- package/lib/structures/ClientUser.d.ts +25 -0
- package/lib/structures/ClientUser.js +52 -0
- package/lib/structures/Guild.d.ts +86 -0
- package/lib/structures/Guild.js +66 -0
- package/lib/structures/GuildEmoji.d.ts +29 -0
- package/lib/structures/GuildEmoji.js +47 -0
- package/lib/structures/GuildMember.d.ts +92 -0
- package/lib/structures/GuildMember.js +137 -0
- package/lib/structures/GuildPreview.d.ts +10 -0
- package/lib/structures/GuildPreview.js +14 -0
- package/lib/structures/GuildRole.d.ts +21 -0
- package/lib/structures/GuildRole.js +32 -0
- package/lib/structures/GuildTemplate.d.ts +23 -0
- package/lib/structures/GuildTemplate.js +36 -0
- package/lib/structures/Interaction.d.ts +152 -0
- package/lib/structures/Interaction.js +409 -0
- package/lib/structures/Message.d.ts +53 -0
- package/lib/structures/Message.js +123 -0
- package/lib/structures/Sticker.d.ts +27 -0
- package/lib/structures/Sticker.js +44 -0
- package/lib/structures/User.d.ts +20 -0
- package/lib/structures/User.js +37 -0
- package/lib/structures/Webhook.d.ts +42 -0
- package/lib/structures/Webhook.js +63 -0
- package/lib/structures/channels.d.ts +232 -0
- package/lib/structures/channels.js +366 -0
- package/lib/structures/extra/Base.d.ts +7 -0
- package/lib/structures/extra/Base.js +39 -0
- package/lib/structures/extra/BaseComponent.d.ts +9 -0
- package/lib/structures/extra/BaseComponent.js +12 -0
- package/lib/structures/extra/BaseGuild.d.ts +40 -0
- package/lib/structures/extra/BaseGuild.js +71 -0
- package/lib/structures/extra/BaseSelectMenuComponent.d.ts +9 -0
- package/lib/structures/extra/BaseSelectMenuComponent.js +13 -0
- package/lib/structures/extra/BitField.d.ts +14 -0
- package/lib/structures/extra/BitField.js +56 -0
- package/lib/structures/extra/DiscordBase.d.ts +18 -0
- package/lib/structures/extra/DiscordBase.js +28 -0
- package/lib/structures/extra/Permissions.d.ts +54 -0
- package/lib/structures/extra/Permissions.js +9 -0
- package/lib/structures/extra/functions.d.ts +11 -0
- package/lib/structures/extra/functions.js +69 -0
- package/lib/structures/index.d.ts +15 -0
- package/lib/structures/index.js +31 -0
- package/lib/websocket/SharedTypes.d.ts +128 -0
- package/lib/websocket/SharedTypes.js +2 -0
- package/lib/websocket/constants/index.d.ts +26 -0
- package/lib/websocket/constants/index.js +31 -0
- package/lib/websocket/discord/basesocket.d.ts +12 -0
- package/lib/websocket/discord/basesocket.js +37 -0
- package/lib/websocket/discord/events/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/events/memberUpdate.js +47 -0
- package/lib/websocket/discord/events/presenceUpdate.d.ts +24 -0
- package/lib/websocket/discord/events/presenceUpdate.js +46 -0
- package/lib/websocket/discord/handlemessage.d.ts +0 -0
- package/lib/websocket/discord/handlemessage.js +1 -0
- package/lib/websocket/discord/index.d.ts +4 -0
- package/lib/websocket/discord/index.js +20 -0
- package/lib/websocket/discord/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/memberUpdate.js +47 -0
- package/lib/websocket/discord/shard.d.ts +46 -0
- package/lib/websocket/discord/shard.js +278 -0
- package/lib/websocket/discord/sharder.d.ts +25 -0
- package/lib/websocket/discord/sharder.js +153 -0
- package/lib/websocket/discord/shared.d.ts +99 -0
- package/lib/websocket/discord/shared.js +8 -0
- package/lib/websocket/discord/worker.d.ts +43 -0
- package/lib/websocket/discord/worker.js +2 -0
- package/lib/websocket/discord/workermanager.d.ts +69 -0
- package/lib/websocket/discord/workermanager.js +273 -0
- package/lib/websocket/index.d.ts +3 -0
- package/lib/websocket/index.js +19 -0
- package/lib/websocket/structures/index.d.ts +117 -0
- package/lib/websocket/structures/index.js +261 -0
- package/lib/websocket/structures/timeout.d.ts +20 -0
- package/lib/websocket/structures/timeout.js +75 -0
- package/package.json +70 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// https://github.com/discordeno/discordeno/blob/main/packages/utils/src/colors.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.stripColor = exports.bgRgb24 = exports.rgb24 = exports.bgRgb8 = exports.rgb8 = exports.bgBrightWhite = exports.bgBrightCyan = exports.bgBrightMagenta = exports.bgBrightBlue = exports.bgBrightYellow = exports.bgBrightGreen = exports.bgBrightRed = exports.bgBrightBlack = exports.bgWhite = exports.bgCyan = exports.bgMagenta = exports.bgBlue = exports.bgYellow = exports.bgGreen = exports.bgRed = exports.bgBlack = exports.brightWhite = exports.brightCyan = exports.brightMagenta = exports.brightBlue = exports.brightYellow = exports.brightGreen = exports.brightRed = exports.brightBlack = exports.gray = exports.white = exports.cyan = exports.magenta = exports.blue = exports.yellow = exports.green = exports.red = exports.black = exports.strikethrough = exports.hidden = exports.inverse = exports.underline = exports.italic = exports.dim = exports.bold = exports.reset = exports.getColorEnabled = exports.setColorEnabled = void 0;
|
|
5
|
+
let enabled = true;
|
|
6
|
+
/**
|
|
7
|
+
* Set changing text color to enabled or disabled
|
|
8
|
+
* @param value
|
|
9
|
+
*/
|
|
10
|
+
function setColorEnabled(value) {
|
|
11
|
+
enabled = value;
|
|
12
|
+
}
|
|
13
|
+
exports.setColorEnabled = setColorEnabled;
|
|
14
|
+
/** Get whether text color change is enabled or disabled. */
|
|
15
|
+
function getColorEnabled() {
|
|
16
|
+
return enabled;
|
|
17
|
+
}
|
|
18
|
+
exports.getColorEnabled = getColorEnabled;
|
|
19
|
+
/**
|
|
20
|
+
* Builds color code
|
|
21
|
+
* @param open
|
|
22
|
+
* @param close
|
|
23
|
+
*/
|
|
24
|
+
function code(open, close) {
|
|
25
|
+
return {
|
|
26
|
+
open: `\x1b[${open.join(';')}m`,
|
|
27
|
+
close: `\x1b[${close}m`,
|
|
28
|
+
regexp: new RegExp(`\\x1b\\[${close}m`, 'g'),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Applies color and background based on color code and its associated text
|
|
33
|
+
* @param str text to apply color settings to
|
|
34
|
+
* @param code color code to apply
|
|
35
|
+
*/
|
|
36
|
+
function run(str, code) {
|
|
37
|
+
return enabled ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` : str;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reset the text modified
|
|
41
|
+
* @param str text to reset
|
|
42
|
+
*/
|
|
43
|
+
function reset(str) {
|
|
44
|
+
return run(str, code([0], 0));
|
|
45
|
+
}
|
|
46
|
+
exports.reset = reset;
|
|
47
|
+
/**
|
|
48
|
+
* Make the text bold.
|
|
49
|
+
* @param str text to make bold
|
|
50
|
+
*/
|
|
51
|
+
function bold(str) {
|
|
52
|
+
return run(str, code([1], 22));
|
|
53
|
+
}
|
|
54
|
+
exports.bold = bold;
|
|
55
|
+
/**
|
|
56
|
+
* The text emits only a small amount of light.
|
|
57
|
+
* @param str text to dim
|
|
58
|
+
*/
|
|
59
|
+
function dim(str) {
|
|
60
|
+
return run(str, code([2], 22));
|
|
61
|
+
}
|
|
62
|
+
exports.dim = dim;
|
|
63
|
+
/**
|
|
64
|
+
* Make the text italic.
|
|
65
|
+
* @param str text to make italic
|
|
66
|
+
*/
|
|
67
|
+
function italic(str) {
|
|
68
|
+
return run(str, code([3], 23));
|
|
69
|
+
}
|
|
70
|
+
exports.italic = italic;
|
|
71
|
+
/**
|
|
72
|
+
* Make the text underline.
|
|
73
|
+
* @param str text to underline
|
|
74
|
+
*/
|
|
75
|
+
function underline(str) {
|
|
76
|
+
return run(str, code([4], 24));
|
|
77
|
+
}
|
|
78
|
+
exports.underline = underline;
|
|
79
|
+
/**
|
|
80
|
+
* Invert background color and text color.
|
|
81
|
+
* @param str text to invert its color
|
|
82
|
+
*/
|
|
83
|
+
function inverse(str) {
|
|
84
|
+
return run(str, code([7], 27));
|
|
85
|
+
}
|
|
86
|
+
exports.inverse = inverse;
|
|
87
|
+
/**
|
|
88
|
+
* Make the text hidden.
|
|
89
|
+
* @param str text to hide
|
|
90
|
+
*/
|
|
91
|
+
function hidden(str) {
|
|
92
|
+
return run(str, code([8], 28));
|
|
93
|
+
}
|
|
94
|
+
exports.hidden = hidden;
|
|
95
|
+
/**
|
|
96
|
+
* Put horizontal line through the center of the text.
|
|
97
|
+
* @param str text to strike through
|
|
98
|
+
*/
|
|
99
|
+
function strikethrough(str) {
|
|
100
|
+
return run(str, code([9], 29));
|
|
101
|
+
}
|
|
102
|
+
exports.strikethrough = strikethrough;
|
|
103
|
+
/**
|
|
104
|
+
* Set text color to black.
|
|
105
|
+
* @param str text to make black
|
|
106
|
+
*/
|
|
107
|
+
function black(str) {
|
|
108
|
+
return run(str, code([30], 39));
|
|
109
|
+
}
|
|
110
|
+
exports.black = black;
|
|
111
|
+
/**
|
|
112
|
+
* Set text color to red.
|
|
113
|
+
* @param str text to make red
|
|
114
|
+
*/
|
|
115
|
+
function red(str) {
|
|
116
|
+
return run(str, code([31], 39));
|
|
117
|
+
}
|
|
118
|
+
exports.red = red;
|
|
119
|
+
/**
|
|
120
|
+
* Set text color to green.
|
|
121
|
+
* @param str text to make green
|
|
122
|
+
*/
|
|
123
|
+
function green(str) {
|
|
124
|
+
return run(str, code([32], 39));
|
|
125
|
+
}
|
|
126
|
+
exports.green = green;
|
|
127
|
+
/**
|
|
128
|
+
* Set text color to yellow.
|
|
129
|
+
* @param str text to make yellow
|
|
130
|
+
*/
|
|
131
|
+
function yellow(str) {
|
|
132
|
+
return run(str, code([33], 39));
|
|
133
|
+
}
|
|
134
|
+
exports.yellow = yellow;
|
|
135
|
+
/**
|
|
136
|
+
* Set text color to blue.
|
|
137
|
+
* @param str text to make blue
|
|
138
|
+
*/
|
|
139
|
+
function blue(str) {
|
|
140
|
+
return run(str, code([34], 39));
|
|
141
|
+
}
|
|
142
|
+
exports.blue = blue;
|
|
143
|
+
/**
|
|
144
|
+
* Set text color to magenta.
|
|
145
|
+
* @param str text to make magenta
|
|
146
|
+
*/
|
|
147
|
+
function magenta(str) {
|
|
148
|
+
return run(str, code([35], 39));
|
|
149
|
+
}
|
|
150
|
+
exports.magenta = magenta;
|
|
151
|
+
/**
|
|
152
|
+
* Set text color to cyan.
|
|
153
|
+
* @param str text to make cyan
|
|
154
|
+
*/
|
|
155
|
+
function cyan(str) {
|
|
156
|
+
return run(str, code([36], 39));
|
|
157
|
+
}
|
|
158
|
+
exports.cyan = cyan;
|
|
159
|
+
/**
|
|
160
|
+
* Set text color to white.
|
|
161
|
+
* @param str text to make white
|
|
162
|
+
*/
|
|
163
|
+
function white(str) {
|
|
164
|
+
return run(str, code([37], 39));
|
|
165
|
+
}
|
|
166
|
+
exports.white = white;
|
|
167
|
+
/**
|
|
168
|
+
* Set text color to gray.
|
|
169
|
+
* @param str text to make gray
|
|
170
|
+
*/
|
|
171
|
+
function gray(str) {
|
|
172
|
+
return brightBlack(str);
|
|
173
|
+
}
|
|
174
|
+
exports.gray = gray;
|
|
175
|
+
/**
|
|
176
|
+
* Set text color to bright black.
|
|
177
|
+
* @param str text to make bright-black
|
|
178
|
+
*/
|
|
179
|
+
function brightBlack(str) {
|
|
180
|
+
return run(str, code([90], 39));
|
|
181
|
+
}
|
|
182
|
+
exports.brightBlack = brightBlack;
|
|
183
|
+
/**
|
|
184
|
+
* Set text color to bright red.
|
|
185
|
+
* @param str text to make bright-red
|
|
186
|
+
*/
|
|
187
|
+
function brightRed(str) {
|
|
188
|
+
return run(str, code([91], 39));
|
|
189
|
+
}
|
|
190
|
+
exports.brightRed = brightRed;
|
|
191
|
+
/**
|
|
192
|
+
* Set text color to bright green.
|
|
193
|
+
* @param str text to make bright-green
|
|
194
|
+
*/
|
|
195
|
+
function brightGreen(str) {
|
|
196
|
+
return run(str, code([92], 39));
|
|
197
|
+
}
|
|
198
|
+
exports.brightGreen = brightGreen;
|
|
199
|
+
/**
|
|
200
|
+
* Set text color to bright yellow.
|
|
201
|
+
* @param str text to make bright-yellow
|
|
202
|
+
*/
|
|
203
|
+
function brightYellow(str) {
|
|
204
|
+
return run(str, code([93], 39));
|
|
205
|
+
}
|
|
206
|
+
exports.brightYellow = brightYellow;
|
|
207
|
+
/**
|
|
208
|
+
* Set text color to bright blue.
|
|
209
|
+
* @param str text to make bright-blue
|
|
210
|
+
*/
|
|
211
|
+
function brightBlue(str) {
|
|
212
|
+
return run(str, code([94], 39));
|
|
213
|
+
}
|
|
214
|
+
exports.brightBlue = brightBlue;
|
|
215
|
+
/**
|
|
216
|
+
* Set text color to bright magenta.
|
|
217
|
+
* @param str text to make bright-magenta
|
|
218
|
+
*/
|
|
219
|
+
function brightMagenta(str) {
|
|
220
|
+
return run(str, code([95], 39));
|
|
221
|
+
}
|
|
222
|
+
exports.brightMagenta = brightMagenta;
|
|
223
|
+
/**
|
|
224
|
+
* Set text color to bright cyan.
|
|
225
|
+
* @param str text to make bright-cyan
|
|
226
|
+
*/
|
|
227
|
+
function brightCyan(str) {
|
|
228
|
+
return run(str, code([96], 39));
|
|
229
|
+
}
|
|
230
|
+
exports.brightCyan = brightCyan;
|
|
231
|
+
/**
|
|
232
|
+
* Set text color to bright white.
|
|
233
|
+
* @param str text to make bright-white
|
|
234
|
+
*/
|
|
235
|
+
function brightWhite(str) {
|
|
236
|
+
return run(str, code([97], 39));
|
|
237
|
+
}
|
|
238
|
+
exports.brightWhite = brightWhite;
|
|
239
|
+
/**
|
|
240
|
+
* Set background color to black.
|
|
241
|
+
* @param str text to make its background black
|
|
242
|
+
*/
|
|
243
|
+
function bgBlack(str) {
|
|
244
|
+
return run(str, code([40], 49));
|
|
245
|
+
}
|
|
246
|
+
exports.bgBlack = bgBlack;
|
|
247
|
+
/**
|
|
248
|
+
* Set background color to red.
|
|
249
|
+
* @param str text to make its background red
|
|
250
|
+
*/
|
|
251
|
+
function bgRed(str) {
|
|
252
|
+
return run(str, code([41], 49));
|
|
253
|
+
}
|
|
254
|
+
exports.bgRed = bgRed;
|
|
255
|
+
/**
|
|
256
|
+
* Set background color to green.
|
|
257
|
+
* @param str text to make its background green
|
|
258
|
+
*/
|
|
259
|
+
function bgGreen(str) {
|
|
260
|
+
return run(str, code([42], 49));
|
|
261
|
+
}
|
|
262
|
+
exports.bgGreen = bgGreen;
|
|
263
|
+
/**
|
|
264
|
+
* Set background color to yellow.
|
|
265
|
+
* @param str text to make its background yellow
|
|
266
|
+
*/
|
|
267
|
+
function bgYellow(str) {
|
|
268
|
+
return run(str, code([43], 49));
|
|
269
|
+
}
|
|
270
|
+
exports.bgYellow = bgYellow;
|
|
271
|
+
/**
|
|
272
|
+
* Set background color to blue.
|
|
273
|
+
* @param str text to make its background blue
|
|
274
|
+
*/
|
|
275
|
+
function bgBlue(str) {
|
|
276
|
+
return run(str, code([44], 49));
|
|
277
|
+
}
|
|
278
|
+
exports.bgBlue = bgBlue;
|
|
279
|
+
/**
|
|
280
|
+
* Set background color to magenta.
|
|
281
|
+
* @param str text to make its background magenta
|
|
282
|
+
*/
|
|
283
|
+
function bgMagenta(str) {
|
|
284
|
+
return run(str, code([45], 49));
|
|
285
|
+
}
|
|
286
|
+
exports.bgMagenta = bgMagenta;
|
|
287
|
+
/**
|
|
288
|
+
* Set background color to cyan.
|
|
289
|
+
* @param str text to make its background cyan
|
|
290
|
+
*/
|
|
291
|
+
function bgCyan(str) {
|
|
292
|
+
return run(str, code([46], 49));
|
|
293
|
+
}
|
|
294
|
+
exports.bgCyan = bgCyan;
|
|
295
|
+
/**
|
|
296
|
+
* Set background color to white.
|
|
297
|
+
* @param str text to make its background white
|
|
298
|
+
*/
|
|
299
|
+
function bgWhite(str) {
|
|
300
|
+
return run(str, code([47], 49));
|
|
301
|
+
}
|
|
302
|
+
exports.bgWhite = bgWhite;
|
|
303
|
+
/**
|
|
304
|
+
* Set background color to bright black.
|
|
305
|
+
* @param str text to make its background bright-black
|
|
306
|
+
*/
|
|
307
|
+
function bgBrightBlack(str) {
|
|
308
|
+
return run(str, code([100], 49));
|
|
309
|
+
}
|
|
310
|
+
exports.bgBrightBlack = bgBrightBlack;
|
|
311
|
+
/**
|
|
312
|
+
* Set background color to bright red.
|
|
313
|
+
* @param str text to make its background bright-red
|
|
314
|
+
*/
|
|
315
|
+
function bgBrightRed(str) {
|
|
316
|
+
return run(str, code([101], 49));
|
|
317
|
+
}
|
|
318
|
+
exports.bgBrightRed = bgBrightRed;
|
|
319
|
+
/**
|
|
320
|
+
* Set background color to bright green.
|
|
321
|
+
* @param str text to make its background bright-green
|
|
322
|
+
*/
|
|
323
|
+
function bgBrightGreen(str) {
|
|
324
|
+
return run(str, code([102], 49));
|
|
325
|
+
}
|
|
326
|
+
exports.bgBrightGreen = bgBrightGreen;
|
|
327
|
+
/**
|
|
328
|
+
* Set background color to bright yellow.
|
|
329
|
+
* @param str text to make its background bright-yellow
|
|
330
|
+
*/
|
|
331
|
+
function bgBrightYellow(str) {
|
|
332
|
+
return run(str, code([103], 49));
|
|
333
|
+
}
|
|
334
|
+
exports.bgBrightYellow = bgBrightYellow;
|
|
335
|
+
/**
|
|
336
|
+
* Set background color to bright blue.
|
|
337
|
+
* @param str text to make its background bright-blue
|
|
338
|
+
*/
|
|
339
|
+
function bgBrightBlue(str) {
|
|
340
|
+
return run(str, code([104], 49));
|
|
341
|
+
}
|
|
342
|
+
exports.bgBrightBlue = bgBrightBlue;
|
|
343
|
+
/**
|
|
344
|
+
* Set background color to bright magenta.
|
|
345
|
+
* @param str text to make its background bright-magenta
|
|
346
|
+
*/
|
|
347
|
+
function bgBrightMagenta(str) {
|
|
348
|
+
return run(str, code([105], 49));
|
|
349
|
+
}
|
|
350
|
+
exports.bgBrightMagenta = bgBrightMagenta;
|
|
351
|
+
/**
|
|
352
|
+
* Set background color to bright cyan.
|
|
353
|
+
* @param str text to make its background bright-cyan
|
|
354
|
+
*/
|
|
355
|
+
function bgBrightCyan(str) {
|
|
356
|
+
return run(str, code([106], 49));
|
|
357
|
+
}
|
|
358
|
+
exports.bgBrightCyan = bgBrightCyan;
|
|
359
|
+
/**
|
|
360
|
+
* Set background color to bright white.
|
|
361
|
+
* @param str text to make its background bright-white
|
|
362
|
+
*/
|
|
363
|
+
function bgBrightWhite(str) {
|
|
364
|
+
return run(str, code([107], 49));
|
|
365
|
+
}
|
|
366
|
+
exports.bgBrightWhite = bgBrightWhite;
|
|
367
|
+
/* Special Color Sequences */
|
|
368
|
+
/**
|
|
369
|
+
* Clam and truncate color codes
|
|
370
|
+
* @param n
|
|
371
|
+
* @param max number to truncate to
|
|
372
|
+
* @param min number to truncate from
|
|
373
|
+
*/
|
|
374
|
+
function clampAndTruncate(n, max = 255, min = 0) {
|
|
375
|
+
return Math.trunc(Math.max(Math.min(n, max), min));
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Set text color using paletted 8bit colors.
|
|
379
|
+
* https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
|
|
380
|
+
* @param str text color to apply paletted 8bit colors to
|
|
381
|
+
* @param color code
|
|
382
|
+
*/
|
|
383
|
+
function rgb8(str, color) {
|
|
384
|
+
return run(str, code([38, 5, clampAndTruncate(color)], 39));
|
|
385
|
+
}
|
|
386
|
+
exports.rgb8 = rgb8;
|
|
387
|
+
/**
|
|
388
|
+
* Set background color using paletted 8bit colors.
|
|
389
|
+
* https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
|
|
390
|
+
* @param str text color to apply paletted 8bit background colors to
|
|
391
|
+
* @param color code
|
|
392
|
+
*/
|
|
393
|
+
function bgRgb8(str, color) {
|
|
394
|
+
return run(str, code([48, 5, clampAndTruncate(color)], 49));
|
|
395
|
+
}
|
|
396
|
+
exports.bgRgb8 = bgRgb8;
|
|
397
|
+
/**
|
|
398
|
+
* Set text color using 24bit rgb.
|
|
399
|
+
* `color` can be a number in range `0x000000` to `0xffffff` or
|
|
400
|
+
* an `Rgb`.
|
|
401
|
+
*
|
|
402
|
+
* To produce the color magenta:
|
|
403
|
+
*
|
|
404
|
+
* ```ts
|
|
405
|
+
* import { rgb24 } from "./colors.ts";
|
|
406
|
+
* rgb24("foo", 0xff00ff);
|
|
407
|
+
* rgb24("foo", {r: 255, g: 0, b: 255});
|
|
408
|
+
* ```
|
|
409
|
+
* @param str text color to apply 24bit rgb to
|
|
410
|
+
* @param color code
|
|
411
|
+
*/
|
|
412
|
+
function rgb24(str, color) {
|
|
413
|
+
if (typeof color === 'number') {
|
|
414
|
+
return run(str, code([38, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 39));
|
|
415
|
+
}
|
|
416
|
+
return run(str, code([38, 2, clampAndTruncate(color.r), clampAndTruncate(color.g), clampAndTruncate(color.b)], 39));
|
|
417
|
+
}
|
|
418
|
+
exports.rgb24 = rgb24;
|
|
419
|
+
/**
|
|
420
|
+
* Set background color using 24bit rgb.
|
|
421
|
+
* `color` can be a number in range `0x000000` to `0xffffff` or
|
|
422
|
+
* an `Rgb`.
|
|
423
|
+
*
|
|
424
|
+
* To produce the color magenta:
|
|
425
|
+
*
|
|
426
|
+
* ```ts
|
|
427
|
+
* import { bgRgb24 } from "./colors.ts";
|
|
428
|
+
* bgRgb24("foo", 0xff00ff);
|
|
429
|
+
* bgRgb24("foo", {r: 255, g: 0, b: 255});
|
|
430
|
+
* ```
|
|
431
|
+
* @param str text color to apply 24bit rgb to
|
|
432
|
+
* @param color code
|
|
433
|
+
*/
|
|
434
|
+
function bgRgb24(str, color) {
|
|
435
|
+
if (typeof color === 'number') {
|
|
436
|
+
return run(str, code([48, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 49));
|
|
437
|
+
}
|
|
438
|
+
return run(str, code([48, 2, clampAndTruncate(color.r), clampAndTruncate(color.g), clampAndTruncate(color.b)], 49));
|
|
439
|
+
}
|
|
440
|
+
exports.bgRgb24 = bgRgb24;
|
|
441
|
+
// https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
|
|
442
|
+
const ANSI_PATTERN = new RegExp([
|
|
443
|
+
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
444
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
|
445
|
+
].join('|'), 'g');
|
|
446
|
+
/**
|
|
447
|
+
* Remove ANSI escape codes from the string.
|
|
448
|
+
* @param string to remove ANSI escape codes from
|
|
449
|
+
*/
|
|
450
|
+
function stripColor(string) {
|
|
451
|
+
return string.replace(ANSI_PATTERN, '');
|
|
452
|
+
}
|
|
453
|
+
exports.stripColor = stripColor;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare enum EmbedColors {
|
|
2
|
+
Default = 0,
|
|
3
|
+
White = 16777215,
|
|
4
|
+
Aqua = 1752220,
|
|
5
|
+
Green = 5763719,
|
|
6
|
+
Blue = 3447003,
|
|
7
|
+
Yellow = 16705372,
|
|
8
|
+
Purple = 10181046,
|
|
9
|
+
LuminousVividPink = 15277667,
|
|
10
|
+
Fuchsia = 15418782,
|
|
11
|
+
Gold = 15844367,
|
|
12
|
+
Orange = 15105570,
|
|
13
|
+
Red = 15548997,
|
|
14
|
+
Grey = 9807270,
|
|
15
|
+
Navy = 3426654,
|
|
16
|
+
DarkAqua = 1146986,
|
|
17
|
+
DarkGreen = 2067276,
|
|
18
|
+
DarkBlue = 2123412,
|
|
19
|
+
DarkPurple = 7419530,
|
|
20
|
+
DarkVividPink = 11342935,
|
|
21
|
+
DarkGold = 12745742,
|
|
22
|
+
DarkOrange = 11027200,
|
|
23
|
+
DarkRed = 10038562,
|
|
24
|
+
DarkGrey = 9936031,
|
|
25
|
+
DarkerGrey = 8359053,
|
|
26
|
+
LightGrey = 12370112,
|
|
27
|
+
DarkNavy = 2899536,
|
|
28
|
+
Blurple = 5793266,
|
|
29
|
+
Greyple = 10070709,
|
|
30
|
+
DarkButNotBlack = 2895667,
|
|
31
|
+
NotQuiteBlack = 2303786
|
|
32
|
+
}
|
|
33
|
+
export declare const DiscordEpoch = 1420070400000n;
|
|
34
|
+
export declare const BASE_HOST = "https://discord.com";
|
|
35
|
+
export declare const BASE_URL = "https://discord.com/api";
|
|
36
|
+
export declare const CDN_URL = "https://cdn.discordapp.com";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDN_URL = exports.BASE_URL = exports.BASE_HOST = exports.DiscordEpoch = exports.EmbedColors = void 0;
|
|
4
|
+
var EmbedColors;
|
|
5
|
+
(function (EmbedColors) {
|
|
6
|
+
EmbedColors[EmbedColors["Default"] = 0] = "Default";
|
|
7
|
+
EmbedColors[EmbedColors["White"] = 16777215] = "White";
|
|
8
|
+
EmbedColors[EmbedColors["Aqua"] = 1752220] = "Aqua";
|
|
9
|
+
EmbedColors[EmbedColors["Green"] = 5763719] = "Green";
|
|
10
|
+
EmbedColors[EmbedColors["Blue"] = 3447003] = "Blue";
|
|
11
|
+
EmbedColors[EmbedColors["Yellow"] = 16705372] = "Yellow";
|
|
12
|
+
EmbedColors[EmbedColors["Purple"] = 10181046] = "Purple";
|
|
13
|
+
EmbedColors[EmbedColors["LuminousVividPink"] = 15277667] = "LuminousVividPink";
|
|
14
|
+
EmbedColors[EmbedColors["Fuchsia"] = 15418782] = "Fuchsia";
|
|
15
|
+
EmbedColors[EmbedColors["Gold"] = 15844367] = "Gold";
|
|
16
|
+
EmbedColors[EmbedColors["Orange"] = 15105570] = "Orange";
|
|
17
|
+
EmbedColors[EmbedColors["Red"] = 15548997] = "Red";
|
|
18
|
+
EmbedColors[EmbedColors["Grey"] = 9807270] = "Grey";
|
|
19
|
+
EmbedColors[EmbedColors["Navy"] = 3426654] = "Navy";
|
|
20
|
+
EmbedColors[EmbedColors["DarkAqua"] = 1146986] = "DarkAqua";
|
|
21
|
+
EmbedColors[EmbedColors["DarkGreen"] = 2067276] = "DarkGreen";
|
|
22
|
+
EmbedColors[EmbedColors["DarkBlue"] = 2123412] = "DarkBlue";
|
|
23
|
+
EmbedColors[EmbedColors["DarkPurple"] = 7419530] = "DarkPurple";
|
|
24
|
+
EmbedColors[EmbedColors["DarkVividPink"] = 11342935] = "DarkVividPink";
|
|
25
|
+
EmbedColors[EmbedColors["DarkGold"] = 12745742] = "DarkGold";
|
|
26
|
+
EmbedColors[EmbedColors["DarkOrange"] = 11027200] = "DarkOrange";
|
|
27
|
+
EmbedColors[EmbedColors["DarkRed"] = 10038562] = "DarkRed";
|
|
28
|
+
EmbedColors[EmbedColors["DarkGrey"] = 9936031] = "DarkGrey";
|
|
29
|
+
EmbedColors[EmbedColors["DarkerGrey"] = 8359053] = "DarkerGrey";
|
|
30
|
+
EmbedColors[EmbedColors["LightGrey"] = 12370112] = "LightGrey";
|
|
31
|
+
EmbedColors[EmbedColors["DarkNavy"] = 2899536] = "DarkNavy";
|
|
32
|
+
EmbedColors[EmbedColors["Blurple"] = 5793266] = "Blurple";
|
|
33
|
+
EmbedColors[EmbedColors["Greyple"] = 10070709] = "Greyple";
|
|
34
|
+
EmbedColors[EmbedColors["DarkButNotBlack"] = 2895667] = "DarkButNotBlack";
|
|
35
|
+
EmbedColors[EmbedColors["NotQuiteBlack"] = 2303786] = "NotQuiteBlack";
|
|
36
|
+
})(EmbedColors || (exports.EmbedColors = EmbedColors = {}));
|
|
37
|
+
exports.DiscordEpoch = 1420070400000n;
|
|
38
|
+
exports.BASE_HOST = 'https://discord.com';
|
|
39
|
+
exports.BASE_URL = `${exports.BASE_HOST}/api`;
|
|
40
|
+
exports.CDN_URL = 'https://cdn.discordapp.com';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export declare enum LogLevels {
|
|
2
|
+
Debug = 0,
|
|
3
|
+
Info = 1,
|
|
4
|
+
Warn = 2,
|
|
5
|
+
Error = 3,
|
|
6
|
+
Fatal = 4
|
|
7
|
+
}
|
|
8
|
+
export type LoggerOptions = {
|
|
9
|
+
logLevel?: LogLevels;
|
|
10
|
+
name?: string;
|
|
11
|
+
active?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type CustomCallback = (self: Logger, level: LogLevels, args: unknown[]) => unknown[];
|
|
14
|
+
/**
|
|
15
|
+
* Represents a logger utility for logging messages with various log levels.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Logger {
|
|
18
|
+
/**
|
|
19
|
+
* The options for configuring the logger.
|
|
20
|
+
*/
|
|
21
|
+
readonly options: Required<LoggerOptions>;
|
|
22
|
+
/**
|
|
23
|
+
* The custom callback function for logging.
|
|
24
|
+
*/
|
|
25
|
+
private static __callback?;
|
|
26
|
+
/**
|
|
27
|
+
* Allows customization of the logging behavior by providing a custom callback function.
|
|
28
|
+
* @param cb The custom callback function for logging.
|
|
29
|
+
* @example
|
|
30
|
+
* Logger.customize((logger, level, args) => {
|
|
31
|
+
* // Custom logging implementation
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
static customize(cb: CustomCallback): void;
|
|
35
|
+
/**
|
|
36
|
+
* Constructs a new Logger instance with the provided options.
|
|
37
|
+
* @param options The options for configuring the logger.
|
|
38
|
+
*/
|
|
39
|
+
constructor(options: LoggerOptions);
|
|
40
|
+
/**
|
|
41
|
+
* Sets the log level of the logger.
|
|
42
|
+
*/
|
|
43
|
+
set level(level: LogLevels);
|
|
44
|
+
/**
|
|
45
|
+
* Gets the log level of the logger.
|
|
46
|
+
*/
|
|
47
|
+
get level(): LogLevels;
|
|
48
|
+
/**
|
|
49
|
+
* Sets whether the logger is active or not.
|
|
50
|
+
*/
|
|
51
|
+
set active(active: boolean);
|
|
52
|
+
/**
|
|
53
|
+
* Gets whether the logger is active or not.
|
|
54
|
+
*/
|
|
55
|
+
get active(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Sets the name of the logger.
|
|
58
|
+
*/
|
|
59
|
+
set name(name: string);
|
|
60
|
+
/**
|
|
61
|
+
* Gets the name of the logger.
|
|
62
|
+
*/
|
|
63
|
+
get name(): string;
|
|
64
|
+
/**
|
|
65
|
+
* Logs a message with the specified log level.
|
|
66
|
+
* @param level The log level.
|
|
67
|
+
* @param args The arguments to log.
|
|
68
|
+
* @returns The logged message.
|
|
69
|
+
*/
|
|
70
|
+
rawLog(level: LogLevels, ...args: unknown[]): void;
|
|
71
|
+
/**
|
|
72
|
+
* Logs a debug message.
|
|
73
|
+
* @param args The arguments to log.
|
|
74
|
+
*/
|
|
75
|
+
debug(...args: any[]): void;
|
|
76
|
+
/**
|
|
77
|
+
* Logs an info message.
|
|
78
|
+
* @param args The arguments to log.
|
|
79
|
+
*/
|
|
80
|
+
info(...args: any[]): void;
|
|
81
|
+
/**
|
|
82
|
+
* Logs a warning message.
|
|
83
|
+
* @param args The arguments to log.
|
|
84
|
+
*/
|
|
85
|
+
warn(...args: any[]): void;
|
|
86
|
+
/**
|
|
87
|
+
* Logs an error message.
|
|
88
|
+
* @param args The arguments to log.
|
|
89
|
+
*/
|
|
90
|
+
error(...args: any[]): void;
|
|
91
|
+
/**
|
|
92
|
+
* Logs a fatal error message.
|
|
93
|
+
* @param args The arguments to log.
|
|
94
|
+
*/
|
|
95
|
+
fatal(...args: any[]): void;
|
|
96
|
+
/**
|
|
97
|
+
* The default options for the logger.
|
|
98
|
+
*/
|
|
99
|
+
static DEFAULT_OPTIONS: Required<LoggerOptions>;
|
|
100
|
+
/**
|
|
101
|
+
* A function that returns the input string as is, without any color modification.
|
|
102
|
+
* @param msg The message to log.
|
|
103
|
+
* @returns The input message as is.
|
|
104
|
+
*/
|
|
105
|
+
static noColor(msg: string): string;
|
|
106
|
+
/**
|
|
107
|
+
* A map containing color functions for different log levels.
|
|
108
|
+
*/
|
|
109
|
+
static colorFunctions: Map<LogLevels, (str: string) => string>;
|
|
110
|
+
/**
|
|
111
|
+
* A map containing prefixes for different log levels.
|
|
112
|
+
*/
|
|
113
|
+
static prefixes: Map<LogLevels, string>;
|
|
114
|
+
}
|