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

sendMessage doesn't send options correctly #39

Open
mbogomazov opened this issue Jan 10, 2021 · 2 comments
Open

sendMessage doesn't send options correctly #39

mbogomazov opened this issue Jan 10, 2021 · 2 comments

Comments

@mbogomazov
Copy link

Try to send this message to a bot(Telegraf.js library)

message = client.makeMessage('@testuser1', options={
    entities: [{
        type: 'mention',
        offset: 0,
        length: 9
    }]
});
await client.sendMessage(message);

but bot receive only

{ message_id: 11,
  from: { id: 1, first_name: 'TestName', username: 'testUserName' },
  chat:
   { id: 1,
     title: 'Test Name',
     first_name: 'TestName',
     username: 'testUserName',
     type: 'private' },
  date: 1610304898,
  text: '@testuser1' }

(without entities). I also tried to send location but bot didn't get too.
How to fix it? Or maybe I should use another method or parameters?

@jehy
Copy link
Owner

jehy commented Jan 11, 2021

Right now many of specific telegram features like mentions, pictures, stickers, polls and so on - are not supported. Just basic messaging. But adding it is pretty simple - PRs welcome!

@mbogomazov
Copy link
Author

mbogomazov commented Jan 11, 2021

Okay, I'm ready to implement it but I can't understand, why bot doesn't get all options which I sent because in makeMessage function there should be all of them(due to merge function)

makeMessage(messageText, options = {}) {
    return merge({
      botToken: this.botToken,
      from: {id: this.userId, first_name: this.firstName, username: this.userName},
      chat: {
        id: this.chatId,
        title: this.chatTitle,
        first_name: this.firstName,
        username: this.userName,
        type: this.type,
      },
      date: Math.floor(Date.now() / 1000),
      text: messageText,
    }, options);
  }

So in which modules I should add handlers of different options(i.e. for entities, files, location)?

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

No branches or pull requests

2 participants