Using The Utilities

Using the utilities is quite easy. All you have to do is import one namespace and you have all of the functionality you could ever wish for.

import { QuackJSUtils } from '@n-f9/quack.js'

Further documentation of the features can be found here. An example of the utilities in action can be found below, it converts any type of color into a hexa code.

import { QuackJSUtils } from '@n-f9/quack.js'

export default (Quack) => {
  Quack.CreateTrigger({
    name: 'color',
    trigger: /color: /g,
    execute(client, message) {
      const color = message.content.replace('color: ', '')
      try {
        const conversion = QuackJSUtils.Color(color)
        message.reply(
          QuackJSUtils.Discord.Embed({
            embeds: [
              {
                title: color,
                color: conversion,
                description: '#' + conversion.toString(16),
              },
            ],
          }),
        )
      } catch (error) {
        message.reply(
          QuackJSUtils.Discord.Embed({
            embeds: [
              {
                title: 'Ahh! An Error!',
              },
            ],
          }),
        )
      }
    },
  })
}

Last updated