Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji.toString() doesn't contain the name anymore #10067

Open
TiltedToast opened this issue Jan 2, 2024 · 0 comments · May be fixed by #10076
Open

Emoji.toString() doesn't contain the name anymore #10067

TiltedToast opened this issue Jan 2, 2024 · 0 comments · May be fixed by #10076

Comments

@TiltedToast
Copy link

TiltedToast commented Jan 2, 2024

Which package is this bug report for?

formatters

Issue description

I noticed that in this commit the toString() implementation for the Emoji class has changed, in order to use the provided formatting functions by the formatters package

This also means that this function will never return anything other than <:_:emoji_id> or <a:_:emoji_id>. The way I understand it, the name can actually be missing under certain circumstances, but it's available 99% of the time so I don't see why it shouldn't be included in the string representation by default.

I originally wanted to just make a PR for this but I'm not quite sure what this is supposed to look like so I figured I should probably open an issue about it first.

Code sample

import Fuse from "fuse.js";

const emojis = await message.guild?.emojis.fetch();
const emojiStrings = Array.from(emojis.map((x) => x.toString());
const fuse = new Fuse(emojiStrings, {
    shouldSort: true,
    threshold: 0.3,
});
const matchedEmojis = fuse.search(searchTerm).map((x) => x.item);
const outputString = matchedEmojis.join(" ");
await message.channel.send(outputString);

Versions

  • discord.js 14.14.1
  • node 21.5.0
  • Windows 11

Issue priority

Medium (should be fixed soon)

Which partials do you have configured?

Channel

Which gateway intents are you subscribing to?

Guilds, GuildMembers, GuildEmojisAndStickers, GuildMessages, GuildMessageReactions, DirectMessages, MessageContent

I have tested this issue on a development release

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants