yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.3k stars 1.5k forks source link

Be able to use reactions on messages #1012

Closed fabianaferreira closed 1 year ago

fabianaferreira commented 1 year ago

Feature Request

Hello! It's my first time here, so hopefully, I'll do it correctly! I have searched for the implementation of the sendReaction method from Telegram API on this Node implementation, but couldn't find anything.

Introduction

I have a bot that gets kind of verbose due to the replies that it does whenever handling some command. Therefore, it would be handy to have a way of reacting to the messages instead of replying to them. It seems to be a good first issue for me to work on, given that it should be pretty similar to the sendMessage method implementation.

Example

How sendMessage is implemented:

  /**
   * Send text message.
   * @param  {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
   * @param  {String} text Text of the message to be sent
   * @param  {Object} [options] Additional Telegram query options
   * @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned
   * @see https://core.telegram.org/bots/api#sendmessage
   */
  sendMessage(chatId, text, form = {}) {
    form.chat_id = chatId;
    form.text = text;
    return this._request('sendMessage', { form });
  }

How I think sendReaction could be implemented:

sendReaction(chatId, messageId, reaction, form = {}) {
    form.chat_id = chatId;
    form.reaction = reaction;
    form.msg_id = messageId;
    return this._request('sendReaction', { form });
}

Of course, this is just the high-level implementation; I still need to go through the _request method and add the necessary types and function signatures to the typings package.

danielperez9430 commented 1 year ago

The think is the Telegram Bot API don't allow you to send reactions or animate emojis in your messages, actually is no possible because the Telegram backend don't allow to do it with the Bot API. Unless Telegram support it, we can't do nothing with it.

Note: The link that you send is from Telegram Client API (apps like your android/iOS app), not Telegram bot API.

This is the uniq docs for the Telegram Bot API: https://core.telegram.org/bots/api

fabianaferreira commented 1 year ago

Hello, @danielperez9430! How are you?

Thank you so much for clarifying it to me, honestly, I didn’t see that the link was for the client APi. Well, with that, I’m pretty sure that I can close the issue as a won’t do, since it’s not possible. Thanks one more time!

ponez commented 1 year ago

@danielperez9430 what about this one ?

https://core.telegram.org/methods#working-with-message-reactions

danielperez9430 commented 1 year ago

@danielperez9430 what about this one ?

https://core.telegram.org/methods#working-with-message-reactions

Hi ponez,

No,this link is also from the client api (not bot api).

The uniq docs for the bot api methods is this url: https://core.telegram.org/bots/api (url end in /bots/api).

lentsd commented 7 months ago

Hello! @danielperez9430 according to last update (Bot API 7.0) https://core.telegram.org/bots/api that seems that telegram added reactions api for bots?

danielperez9430 commented 7 months ago

Yep, we need to upadate the lib. Maybe I can do it this weekend once for all 🫣

lentsd commented 7 months ago

If i have time i will try to contribute 👍🏼