-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: إعادة تسمية صنف البوت الرئيسي وكلمة اللون
... BREAKING CHANGE: تم تغيير امس الصنف DiscordBot إلى Bot فعلى المستحدم تغيير الاسم تبعاً
- Loading branch information
Assayyaad
committed
Sep 3, 2024
1 parent
d6fc420
commit c59f0f8
Showing
9 changed files
with
77 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { DiscordBot } from './class/discordBot.js' | ||
export { asNumber, asString } from './func/colour.js' | ||
export { Bot } from './class/bot.js' | ||
export { asNumber, asString } from './func/color.js' | ||
export { asEmbed, applyStyle } from './func/style.js' | ||
export * from './options.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Get a color as a number. | ||
* @param {string | number} color - The color value. | ||
* @returns {number} The color as a number. | ||
* @example | ||
* const num = asNumber('#ffffff') | ||
* // num = 0xffffff | ||
* @example | ||
* const num = asNumber(0xffffff) | ||
* // num = 0xffffff | ||
*/ | ||
export function asNumber(color) { | ||
let num | ||
|
||
if (typeof color === 'number') num = color | ||
else if (typeof color === 'string') num = Number.parseInt(color.substring(1), 16) | ||
|
||
if (num) return num | ||
else return 0 | ||
} | ||
|
||
/** | ||
* Get a color as a string. | ||
* @param {string | number} color - The color value. | ||
* @returns {string} The color as a string. | ||
* @example | ||
* const num = asNumber('#ffffff') | ||
* // num = '#ffffff' | ||
* @example | ||
* const num = asNumber(0xffffff) | ||
* // num = '#ffffff' | ||
*/ | ||
export function asString(color) { | ||
let str | ||
|
||
if (typeof color === 'string') str = color.startsWith('#') ? color.substring(1) : color | ||
else if (typeof color === 'number') str = color.toString(16) | ||
|
||
if (str) { | ||
while (str.length < 6) str = '0' + str | ||
return `#${str}` | ||
} else return `#000000` | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters