grammyjs / emoji

Helpers for sending emojis.
https://grammy.dev/plugins/emoji
MIT License
9 stars 2 forks source link

Swallowing an error if no emoji is found #13

Closed niusia-ua closed 1 year ago

niusia-ua commented 1 year ago

Hello. While using this plugin I found an awkward situation that ctx.emoji cannot be used to concatenate anything other than just emojis or plain text. you have to create constructions that are difficult to read and use, like this:

// since i need to localize the text (i18n)
// i have to get the localized text by id first
`${ctx.t('books')} ${ctx.emoji`${'books'}`}`

Although it would be more convenient to do this:

ctx.emoji`${ctx.t('books')} ${'books'}`

And all because ctx.emoji returns an exception if no emoji is found. I consider this unnecessary, because if the emoji is not displayed, then the developer will simply go and find the triple emoji in the plugin resources.

Maybe I'm wrong in my thinking, and it goes against the philosophy of the plugin, so I'd be happy to hear back.

KnorpelSenf commented 1 year ago

@andrrms do you want to take care of this?

niusia-ua commented 1 year ago

if you do not mind. I could create a pull request for it.

KnorpelSenf commented 1 year ago

Sure, please go ahead! Looking forward to your changes!

dcdunkan commented 1 year ago

Closing due to #14.