> For the complete documentation index, see [llms.txt](https://n-f9.gitbook.io/quack.js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://n-f9.gitbook.io/quack.js/api/namespace/quackjsutils.md).

# QuackJSUtils

### Namespaces

* Discord

### Classes

* HTML

### Variables

#### Variables

• **Variables**: `Record`<`string`, `any`> = `{}`

**Defined in**

[src/handlers/variables.ts:1](https://github.com/N-F9/quack.js/blob/08ab7ae/src/handlers/variables.ts#L1)

### Functions

#### Backup

▸ `Const` **Backup**(`file`): `void`

A function for generating a backup of a file.

**Parameters**

| Name   | Type     | Description                      |
| ------ | -------- | -------------------------------- |
| `file` | `string` | The file that will be backed up. |

**Returns**

`void`

**Defined in**

[src/modules/functions.ts:155](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L155)

***

#### Color

▸ `Const` **Color**(`color`): `number`

A function for converting any color variation to an base 10 number.

**Parameters**

| Name    | Type     | Description             |
| ------- | -------- | ----------------------- |
| `color` | `string` | The color to be parsed. |

**Returns**

`number`

The `number` version of `color`.

**Defined in**

[src/handlers/color.ts:9](https://github.com/N-F9/quack.js/blob/08ab7ae/src/handlers/color.ts#L9)

***

#### Debug

▸ `Const` **Debug**(`obj`, `name?`): `void`

A function for debugging Functions or Objects

**Parameters**

| Name   | Type                   | Default value | Description                       |
| ------ | ---------------------- | ------------- | --------------------------------- |
| `obj`  | `Object` \| `Function` | `undefined`   | The object/function to be tested. |
| `name` | `string`               | `'none'`      | The name of the debug call.       |

**Returns**

`void`

**Defined in**

[src/modules/log.ts:35](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/log.ts#L35)

***

#### Emoji

▸ `Const` **Emoji**(`e`): `string`

A function for grabbing the id of a custom emoji.

**Parameters**

| Name | Type     | Description             |
| ---- | -------- | ----------------------- |
| `e`  | `string` | The emoji to be parsed. |

**Returns**

`string`

The string representation of the emoji.

**Defined in**

[src/modules/functions.ts:146](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L146)

***

#### Exception

▸ `Const` **Exception**(`e`): `void`

A function for handling errors.

**Parameters**

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
| `e`  | `Error` | The error to be processed. |

**Returns**

`void`

**Defined in**

[src/modules/functions.ts:37](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L37)

***

#### GenerateID

▸ `Const` **GenerateID**(`length?`, `base?`): `string`

A function for generating a random id.

**Parameters**

| Name     | Type     | Default value | Description                          |
| -------- | -------- | ------------- | ------------------------------------ |
| `length` | `number` | `8`           | The length for which the id will be. |
| `base`   | `number` | `16`          | The base for which the id will be.   |

**Returns**

`string`

Returns a random id with a base of `base` and length of `length`.

**Defined in**

[src/modules/functions.ts:127](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L127)

***

#### GetFiles

▸ `Const` **GetFiles**(`directory`): `string`\[]

A function for grabbing all of the files in a directory.

**Parameters**

| Name        | Type     | Description                  |
| ----------- | -------- | ---------------------------- |
| `directory` | `string` | The directory to be scanned. |

**Returns**

`string`\[]

All of the files' paths in a directory.

**Defined in**

[src/modules/functions.ts:48](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L48)

***

#### Locale

▸ `Const` **Locale**(): `Object`

A function for grabbing the language file.

**Returns**

`Object`

The locale of given location if it is created under `locales.ts`.

| Name                        | Type     |
| --------------------------- | -------- |
| `commands`                  | `Object` |
| `commands.errors`           | `Object` |
| `commands.errors.creation`  | `string` |
| `commands.errors.execution` | `string` |
| `commands.errors.names`     | `string` |
| `discord`                   | `Object` |
| `discord.errors`            | `Object` |
| `discord.errors.category`   | `string` |
| `discord.errors.channel`    | `string` |
| `discord.errors.emoji`      | `string` |
| `discord.errors.role`       | `string` |
| `utils`                     | `Object` |
| `utils.errors`              | `Object` |
| `utils.errors.error`        | `string` |
| `utils.success`             | `Object` |
| `utils.success.backup`      | `string` |

**Defined in**

[src/handlers/locale.ts:11](https://github.com/N-F9/quack.js/blob/08ab7ae/src/handlers/locale.ts#L11)

***

#### Log

▸ `Const` **Log**(`message`, `type?`): `void`

A function for logging a specific message.

**Parameters**

| Name      | Type                                      | Default value | Description               |
| --------- | ----------------------------------------- | ------------- | ------------------------- |
| `message` | `string`                                  | `undefined`   | The message to be logged. |
| `type`    | `"i"` \| `"e"` \| `"s"` \| `"w"` \| `"d"` | `'i'`         | The type of log.          |

**Returns**

`void`

**Defined in**

[src/modules/log.ts:11](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/log.ts#L11)

***

#### MS

▸ `Const` **MS**(`value`, `options?`): `string`

**Parameters**

| Name           | Type      |
| -------------- | --------- |
| `value`        | `number`  |
| `options?`     | `Object`  |
| `options.long` | `boolean` |

**Returns**

`string`

**Defined in**

[src/modules/functions.ts:164](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L164)

▸ `Const` **MS**(`value`): `number`

**Parameters**

| Name    | Type     |
| ------- | -------- |
| `value` | `string` |

**Returns**

`number`

**Defined in**

[src/modules/functions.ts:164](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L164)

***

#### MkDir

▸ `Const` **MkDir**(`name`): `boolean`

A function for creating directories.

**Parameters**

| Name   | Type     | Description                           |
| ------ | -------- | ------------------------------------- |
| `name` | `string` | The name of the directory to be made. |

**Returns**

`boolean`

`true` if the directory was made, `false` if the directory was not made.

**Defined in**

[src/modules/functions.ts:72](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L72)

***

#### PadWithZeros

▸ `Const` **PadWithZeros**(`number`, `length`): `string`

A function for padding a number with zeros; usefully for ticketing modules.

**Parameters**

| Name     | Type     | Description                               |
| -------- | -------- | ----------------------------------------- |
| `number` | `number` | The number to be parsed.                  |
| `length` | `number` | The length of which the string should be. |

**Returns**

`string`

A string with the `number` and the number of padded zeros in front of it.

**Defined in**

[src/modules/functions.ts:88](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L88)

***

#### Random

▸ `Const` **Random**(`min`, `max`): `number`

A function for generating a random number between min and max inclusively.

**Parameters**

| Name  | Type     | Description                                  |
| ----- | -------- | -------------------------------------------- |
| `min` | `number` | The minimum amount the function will return. |
| `max` | `number` | The maximum amount the function will return. |

**Returns**

`number`

A random number between `min` and `max`.

**Defined in**

[src/modules/functions.ts:103](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L103)

***

#### RandomizeCapitalization

▸ `Const` **RandomizeCapitalization**(`string`): `string`

A function for randomly capitalizing a string.

**Parameters**

| Name     | Type     | Description                            |
| -------- | -------- | -------------------------------------- |
| `string` | `string` | The string to be randomly capitalized. |

**Returns**

`string`

A string with random capitalization.

**Defined in**

[src/modules/functions.ts:113](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L113)

***

#### Time

▸ `Const` **Time**(`date?`): `QuackJSTime`

A function which returns an object containing useful time numbers and information.

**Parameters**

| Name   | Type   | Description                      |
| ------ | ------ | -------------------------------- |
| `date` | `Date` | The date that will be processed. |

**Returns**

`QuackJSTime`

An object for time purposes.

**Defined in**

[src/modules/functions.ts:16](https://github.com/N-F9/quack.js/blob/08ab7ae/src/modules/functions.ts#L16)
