Skip to content

Releases: Advanced-Command-Handler/Discord.js-Better-Embed

v1.3.0

09 Aug 23:39
Compare
Choose a tag to compare

This is a small update on the surface but that hugelly improve the typings.
Now templates can have a values field the defines the values they are waiting, this will allow you to have autocompletion for the values argument, but because of Typescript behaviors you have to cast the template for a custom template and it cannot work if you use the name.

Example :

import {BetterEmbed, templates} from 'discord.js-better-embed';
import type {Template} from 'discords.js-better-embed';

// Create your template, you could also set the fields of the Template but it's not used anywhere so no need for that
type MyTemplate = Template<{text: string, bar: string}> 
// Add the property to the 'templates' object
interface templates {
    myTemplate: MyTemplate
}

// Setup the template
templates.myTemplate = {
    description: 'Hi ${bar} ! You have ${text.length} bits.'
}

// create your embed
// if you use the name it cannot be casted
const embed = BetterEmbed.fromTemplate(templates.myTemplate as MyTemplate, {text: 'foo', bar: 'baz' });
// but you can do this
const embed = BetterEmbed.fromTemplate<'myTemplate', MyTemplate['values']>('myTemplate', {text: 'foo', bar: 'baz' });

// you can also use it like this :
const embed = BetterEmbed.fromTemplate(templates.myTemplate as templates['myTemplate'], {text: 'foo', bar: 'baz' });
// as it will use the interface types

Thanks to the people using this library !

📆 09.08.2021 🏷️ 1.3.0 💾 C52F54D 🚀 1 📚 1 ✏️ 1 👥 1

🚀 New Features

  • D246D78 feat: Make templates have a possible values fields to define the values needed. (@Ayfri)

📚 Documentation

  • AB6364D docs(readme): Add information about discord.js v12. (@Ayfri)

✏️ Chores

👥 Contributors

v1.2.1

02 Jul 17:59
Compare
Choose a tag to compare

This release includes the new description limit from discord that is now 4096 instead of 2048.

Changelog

  • feat: Set new description limit. (e482972)

v1.2.0

14 May 22:06
Compare
Choose a tag to compare

This release refactors a lot of methods, there are some breaking changes so be careful when upgrading.

Changelog

  • feat: Add badges. (c823e28)
  • feat: Add documentation link. (addc8f7)
  • feat: Add keywords in package.json. (740c9df)
  • feat: Add setImageFromFile & setThumbnailFromFile. (b0cbbd3)
  • feat: Add static limits & templates properties. (0a120ab)
  • feat: Add throwIfTooLong method. (a7e396d)
  • feat: Improve typings of Templates. (72b220d) (c88a947)
  • feat: Rename old checkSize to throwIfTooLong, checkSize now return boolean, and you can select field with an argument. (82214a1)
  • refactor: Ignore package-lock.json. (97d93bb)
  • refactor: Improve exports. (fb9d9b4)
  • refactor: Improve types. (0f27a2e)
  • style: Improve prettier script file selection. (d343558)

Dependencies

[email protected]
[email protected]
@types/[email protected]

v1.1.0

15 Dec 00:43
Compare
Choose a tag to compare

This release is here to improve error messages.

Changelog

Added actual length to error messages. (d8bb76f)
Added apostrophes to error messages for readability. (a64e71a)
Fixed error message for having too much fields. (8554313)
Fixed duplicate error for embed.title. (27a9516)
Updated typescript to @4.1.3. (6f985d4)

v1.0.4

14 Dec 15:44
Compare
Choose a tag to compare

Mini-release (normally last) to fix exports and types, you should be able to use it in TS (and JS, CJS etc).

v1.0.3

10 Dec 14:24
Compare
Choose a tag to compare

Mini-release to fix typings when using this lib in TS.

Changelog

Added property type in package.json. (76fc8f4)

v1.0.2

10 Dec 09:07
Compare
Choose a tag to compare

Micro-release just to fix installing the lib.

Changelog

Added prepublish script. (f924901)

v1.0.1

10 Dec 08:58
Compare
Choose a tag to compare

Micro-release to fix github action.

Changelog

Changed package name to discord.js-better-embed. (7b1a205)

v1.0.0

10 Dec 08:47
Compare
Choose a tag to compare

First Release!

I've used this class in other projects (like Advanced-Command-Handler) but I think that making a repo only for this can be a great thing!
Documentation will eventually come later :)