diff --git a/packages/bot/src/handlers/channels/CHANNEL_CREATE.ts b/packages/bot/src/handlers/channels/CHANNEL_CREATE.ts index f5f1dae00..01aec80b2 100644 --- a/packages/bot/src/handlers/channels/CHANNEL_CREATE.ts +++ b/packages/bot/src/handlers/channels/CHANNEL_CREATE.ts @@ -1,5 +1,4 @@ -import type { DiscordChannel, DiscordGatewayPayload } from '@discordeno/bot' -import type { Bot } from '../../index.js' +import type { Bot, DiscordChannel, DiscordGatewayPayload } from '../../index.js' export async function handleChannelCreate(bot: Bot, payload: DiscordGatewayPayload, shardId: number): Promise { const channel = bot.transformers.channel(bot, { diff --git a/packages/bot/src/transformers/activity.ts b/packages/bot/src/transformers/activity.ts index 40f4b1722..0222c5a7e 100644 --- a/packages/bot/src/transformers/activity.ts +++ b/packages/bot/src/transformers/activity.ts @@ -1,5 +1,4 @@ -import type { DiscordActivity } from '@discordeno/bot' -import type { Bot } from '../index.js' +import type { Bot, DiscordActivity } from '../index.js' import type { Optionalize } from '../optionalize.js' // eslint-disable-next-line @typescript-eslint/explicit-function-return-type diff --git a/packages/bot/src/transformers/application.ts b/packages/bot/src/transformers/application.ts index 081c9313c..5d492c3e0 100644 --- a/packages/bot/src/transformers/application.ts +++ b/packages/bot/src/transformers/application.ts @@ -1,5 +1,4 @@ -import { iconHashToBigInt, type DiscordApplication } from '@discordeno/bot' -import type { Bot } from '../index.js' +import { iconHashToBigInt, type Bot, type DiscordApplication } from '../index.js' import type { Optionalize } from '../optionalize.js' // eslint-disable-next-line @typescript-eslint/explicit-function-return-type diff --git a/packages/bot/src/transformers/reverse/activity.ts b/packages/bot/src/transformers/reverse/activity.ts index 0c5184bed..dfe3135b2 100644 --- a/packages/bot/src/transformers/reverse/activity.ts +++ b/packages/bot/src/transformers/reverse/activity.ts @@ -1,5 +1,4 @@ -import type { DiscordActivity } from '@discordeno/bot' -import type { Bot } from '../../index.js' +import type { Bot, DiscordActivity } from '../../index.js' import type { Activity } from '../activity.js' export function transformActivityToDiscordActivity(bot: Bot, payload: Activity): DiscordActivity { diff --git a/packages/bot/src/transformers/reverse/allowedMentions.ts b/packages/bot/src/transformers/reverse/allowedMentions.ts index 3a26109f9..b0ea8bb00 100644 --- a/packages/bot/src/transformers/reverse/allowedMentions.ts +++ b/packages/bot/src/transformers/reverse/allowedMentions.ts @@ -1,5 +1,4 @@ -import type { AllowedMentions, DiscordAllowedMentions } from '@discordeno/bot' -import type { Bot } from '../../index.js' +import type { AllowedMentions, Bot, DiscordAllowedMentions } from '../../index.js' export function transformAllowedMentionsToDiscordAllowedMentions(bot: Bot, mentions: AllowedMentions): DiscordAllowedMentions { return { diff --git a/packages/bot/src/transformers/reverse/application.ts b/packages/bot/src/transformers/reverse/application.ts index 7eef46a0d..fa40134b5 100644 --- a/packages/bot/src/transformers/reverse/application.ts +++ b/packages/bot/src/transformers/reverse/application.ts @@ -1,5 +1,4 @@ -import { iconBigintToHash, type DiscordApplication } from '@discordeno/bot' -import type { Bot } from '../../index.js' +import { iconBigintToHash, type Bot, type DiscordApplication } from '../../index.js' import type { Application } from '../application.js' export function transformApplicationToDiscordApplication(bot: Bot, payload: Application): DiscordApplication { diff --git a/packages/bot/src/transformers/reverse/applicationCommand.ts b/packages/bot/src/transformers/reverse/applicationCommand.ts index a63c01c59..182289ed3 100644 --- a/packages/bot/src/transformers/reverse/applicationCommand.ts +++ b/packages/bot/src/transformers/reverse/applicationCommand.ts @@ -1,5 +1,4 @@ -import type { DiscordApplicationCommand } from '@discordeno/bot' -import type { Bot } from '../../index.js' +import type { Bot, DiscordApplicationCommand } from '../../index.js' import type { ApplicationCommand } from '../applicationCommand.js' export function transformApplicationCommandToDiscordApplicationCommand(bot: Bot, payload: ApplicationCommand): DiscordApplicationCommand { diff --git a/packages/bot/src/transformers/reverse/applicationCommandOption.ts b/packages/bot/src/transformers/reverse/applicationCommandOption.ts index 6c5820896..5b374c43f 100644 --- a/packages/bot/src/transformers/reverse/applicationCommandOption.ts +++ b/packages/bot/src/transformers/reverse/applicationCommandOption.ts @@ -1,5 +1,4 @@ -import type { DiscordApplicationCommandOption } from '@discordeno/bot' -import type { Bot } from '../../index.js' +import type { Bot, DiscordApplicationCommandOption } from '../../index.js' import type { ApplicationCommandOption } from '../applicationCommandOption.js' export function transformApplicationCommandOptionToDiscordApplicationCommandOption( diff --git a/packages/bot/src/transformers/reverse/applicationCommandOptionChoice.ts b/packages/bot/src/transformers/reverse/applicationCommandOptionChoice.ts index c380669b7..f734f120b 100644 --- a/packages/bot/src/transformers/reverse/applicationCommandOptionChoice.ts +++ b/packages/bot/src/transformers/reverse/applicationCommandOptionChoice.ts @@ -1,5 +1,4 @@ -import type { DiscordApplicationCommandOptionChoice } from '@discordeno/bot' -import type { Bot } from '../../index.js' +import type { Bot, DiscordApplicationCommandOptionChoice } from '../../index.js' import type { ApplicationCommandOptionChoice } from '../applicationCommandOptionChoice.js' export function transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice( diff --git a/packages/bot/src/transformers/reverse/applicationCommandPermission.ts b/packages/bot/src/transformers/reverse/applicationCommandPermission.ts index 3ce0721b5..ff0348806 100644 --- a/packages/bot/src/transformers/reverse/applicationCommandPermission.ts +++ b/packages/bot/src/transformers/reverse/applicationCommandPermission.ts @@ -1,5 +1,4 @@ -import type { DiscordGuildApplicationCommandPermissions } from '@discordeno/bot' -import type { Bot } from '../../index.js' +import type { Bot, DiscordGuildApplicationCommandPermissions } from '../../index.js' import type { ApplicationCommandPermission } from '../applicationCommandPermission.js' export function transformApplicationCommandPermissionToDiscordApplicationCommandPermission( diff --git a/packages/bot/src/transformers/reverse/attachment.ts b/packages/bot/src/transformers/reverse/attachment.ts index 8bb5374d3..2f1b19bd4 100644 --- a/packages/bot/src/transformers/reverse/attachment.ts +++ b/packages/bot/src/transformers/reverse/attachment.ts @@ -1,5 +1,4 @@ -import type { DiscordAttachment } from '@discordeno/bot' -import type { Bot } from '../../index.js' +import type { Bot, DiscordAttachment } from '../../index.js' import type { Attachment } from '../attachment.js' export function transformAttachmentToDiscordAttachment(bot: Bot, payload: Attachment): DiscordAttachment { diff --git a/packages/bot/src/transformers/reverse/createApplicationCommand.ts b/packages/bot/src/transformers/reverse/createApplicationCommand.ts index 6de459d8a..7a126e64c 100644 --- a/packages/bot/src/transformers/reverse/createApplicationCommand.ts +++ b/packages/bot/src/transformers/reverse/createApplicationCommand.ts @@ -1,6 +1,5 @@ -import type { CreateApplicationCommand, DiscordCreateApplicationCommand } from '@discordeno/bot' import { calculateBits } from '@discordeno/utils' -import type { Bot } from '../../index.js' +import type { Bot, CreateApplicationCommand, DiscordCreateApplicationCommand } from '../../index.js' import { isContextApplicationCommand } from '../../typings.js' export function transformCreateApplicationCommandToDiscordCreateApplicationCommand( diff --git a/packages/bot/src/transformers/toggles/emoji.ts b/packages/bot/src/transformers/toggles/emoji.ts index d4c8aa829..a7197c366 100644 --- a/packages/bot/src/transformers/toggles/emoji.ts +++ b/packages/bot/src/transformers/toggles/emoji.ts @@ -1,4 +1,4 @@ -import type { DiscordEmoji } from '@discordeno/bot' +import type { DiscordEmoji } from '@discordeno/types' import { ToggleBitfield } from './ToggleBitfield.js' export const EmojiToggle = { diff --git a/packages/bot/src/transformers/toggles/guild.ts b/packages/bot/src/transformers/toggles/guild.ts index ecfba4fe5..677d7233b 100644 --- a/packages/bot/src/transformers/toggles/guild.ts +++ b/packages/bot/src/transformers/toggles/guild.ts @@ -1,4 +1,4 @@ -import { GuildFeatures, type DiscordGuild } from '@discordeno/bot' +import { GuildFeatures, type DiscordGuild } from '@discordeno/types' import { ToggleBitfieldBigint } from './ToggleBitfield.js' const featureNames = [ diff --git a/packages/bot/src/transformers/toggles/member.ts b/packages/bot/src/transformers/toggles/member.ts index 765a23e7c..85228c127 100644 --- a/packages/bot/src/transformers/toggles/member.ts +++ b/packages/bot/src/transformers/toggles/member.ts @@ -1,4 +1,4 @@ -import type { DiscordMember } from '@discordeno/bot' +import type { DiscordMember } from '@discordeno/types' import { ToggleBitfield } from './ToggleBitfield.js' export const MemberToggle = { diff --git a/packages/bot/src/transformers/toggles/role.ts b/packages/bot/src/transformers/toggles/role.ts index 581156383..d47b43baf 100644 --- a/packages/bot/src/transformers/toggles/role.ts +++ b/packages/bot/src/transformers/toggles/role.ts @@ -1,4 +1,4 @@ -import type { DiscordRole } from '@discordeno/bot' +import type { DiscordRole } from '@discordeno/types' import { ToggleBitfield } from './ToggleBitfield.js' export const RoleToggle = { diff --git a/packages/bot/src/transformers/toggles/user.ts b/packages/bot/src/transformers/toggles/user.ts index b69ea1928..bd4690085 100644 --- a/packages/bot/src/transformers/toggles/user.ts +++ b/packages/bot/src/transformers/toggles/user.ts @@ -1,4 +1,4 @@ -import type { DiscordUser } from '@discordeno/bot' +import type { DiscordUser } from '@discordeno/types' import { ToggleBitfield } from './ToggleBitfield.js' export const UserToggle = { diff --git a/packages/bot/src/transformers/toggles/voice.ts b/packages/bot/src/transformers/toggles/voice.ts index 4465fe4e8..7ad536d7e 100644 --- a/packages/bot/src/transformers/toggles/voice.ts +++ b/packages/bot/src/transformers/toggles/voice.ts @@ -1,4 +1,4 @@ -import type { DiscordVoiceState } from '@discordeno/bot' +import type { DiscordVoiceState } from '@discordeno/types' import { ToggleBitfield } from './ToggleBitfield.js' export const VoiceStateToggle = { diff --git a/packages/bot/src/transformers/widget.ts b/packages/bot/src/transformers/widget.ts index 42a244678..78061610b 100644 --- a/packages/bot/src/transformers/widget.ts +++ b/packages/bot/src/transformers/widget.ts @@ -1,6 +1,5 @@ -import { iconHashToBigInt } from '@discordeno/bot' import type { DiscordGuildWidget } from '@discordeno/types' -import type { Bot } from '../index.js' +import { iconHashToBigInt, type Bot } from '../index.js' import type { Optionalize } from '../optionalize.js' // eslint-disable-next-line @typescript-eslint/explicit-function-return-type diff --git a/packages/utils/tests/color.spec.ts b/packages/utils/tests/color.spec.ts index e99e93477..dc1d2ac61 100644 --- a/packages/utils/tests/color.spec.ts +++ b/packages/utils/tests/color.spec.ts @@ -4,61 +4,35 @@ import * as colors from '../src/colors.js' const arrayOfColors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'] -describe('color.ts', () => { - arrayOfColors.forEach((color, index) => { - describe(`${color} function`, () => { - it('will return colored word', () => { - expect((colors[color as keyof typeof colors] as typeof colors.black)('testWord')).to.equal(`\x1B[${30 + index}mtestWord\x1B[39m`) - }) - }) +describe('Colors', () => { + it(`Color functions will return colored word`, () => { + for (const [index, color] of arrayOfColors.entries()) { + const value = (colors[color as keyof typeof colors] as typeof colors.black)('testWord') + expect(value).equals(`\x1B[${30 + index}mtestWord\x1B[39m`) + + const brightName = `bright${color.slice(0, 1).toUpperCase()}${color.slice(1)}` + const brightValue = (colors[brightName as keyof typeof colors] as typeof colors.black)('testWord') + expect(brightValue).to.equal(`\x1B[${90 + index}mtestWord\x1B[39m`) + + const bgName = `bg${color.slice(0, 1).toUpperCase()}${color.slice(1)}` + const bgValue = (colors[bgName as keyof typeof colors] as typeof colors.black)('testWord') + expect(bgValue).to.equal(`\x1B[${40 + index}mtestWord\x1B[49m`, `Color ${color} has failed .`) + + const bgBrightName = `bgBright${color.slice(0, 1).toUpperCase()}${color.slice(1)}` + const bgBrightValue = (colors[bgBrightName as keyof typeof colors] as typeof colors.black)('testWord') + expect(bgBrightValue).to.equal(`\x1B[${100 + index}mtestWord\x1B[49m`) + } }) - describe(`grey function`, () => { - it('will return colored word', () => { - expect(colors.gray('testWord')).to.equal(`\x1B[${90}mtestWord\x1B[39m`) - }) + it('Will return grey colored word', () => { + expect(colors.gray('testWord')).to.equal(`\x1B[${90}mtestWord\x1B[39m`) }) - arrayOfColors - .map((color) => `bright${color.slice(0, 1).toUpperCase()}${color.slice(1)}`) - .forEach((color, index) => { - describe(`${color} function`, () => { - it('will return colored word', () => { - expect((colors[color as keyof typeof colors] as typeof colors.brightBlack)('testWord')).to.equal(`\x1B[${90 + index}mtestWord\x1B[39m`) - }) - }) - }) - arrayOfColors - .map((color) => `bg${color.slice(0, 1).toUpperCase()}${color.slice(1)}`) - .forEach((color, index) => { - describe(`${color} function`, () => { - it('will return colored word', () => { - expect((colors[color as keyof typeof colors] as typeof colors.bgBlack)('testWord')).to.equal(`\x1B[${40 + index}mtestWord\x1B[49m`) - }) - }) - }) - - arrayOfColors - .map((color) => `bgBright${color.slice(0, 1).toUpperCase()}${color.slice(1)}`) - .forEach((color, index) => { - describe(`${color} function`, () => { - it('will return colored word', () => { - expect((colors[color as keyof typeof colors] as typeof colors.bgBlack)('testWord')).to.equal(`\x1B[${100 + index}mtestWord\x1B[49m`) - }) - }) - }) - - describe('get and set color enabled', () => { - it('by default color should be on', () => { - expect(colors.getColorEnabled()).to.equal(true) - }) - - it('Set it off and on', () => { - expect(colors.getColorEnabled()).to.equal(true) - colors.setColorEnabled(false) - expect(colors.getColorEnabled()).to.equal(false) - colors.setColorEnabled(true) - expect(colors.getColorEnabled()).to.equal(true) - }) + it('Set and get colors enabled value', () => { + expect(colors.getColorEnabled()).to.equal(true) + colors.setColorEnabled(false) + expect(colors.getColorEnabled()).to.equal(false) + colors.setColorEnabled(true) + expect(colors.getColorEnabled()).to.equal(true) }) })