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

Can't get if user is premium #1217

Closed
mohsenemx opened this issue Jul 17, 2024 · 1 comment
Closed

Can't get if user is premium #1217

mohsenemx opened this issue Jul 17, 2024 · 1 comment

Comments

@mohsenemx
Copy link

mohsenemx commented Jul 17, 2024

I'm trying to see if a user is subscribed to Telegram Premium, according to official telegram docs, the User object has a field called 'is_premium' but I can't seem to find it in node-telegram-bot-api.

What I have tried:

  1. Getting user object with getChatMember:
    bot.getChatMember(msg.chat.id, msg.from.id).then((chat) => {
      console.log(chat.user);
    });
  1. Using msg.from/msg.chat

and none of these have what I'm looking for, can anyone help?

@mohsenemx
Copy link
Author

Ok, for people looking at this in the future, when the bot recieves a message, msg will cointain a field, named from that is a User object. If user is not premium, msg.from.is_premium is undefined, if they do, it will become true

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

No branches or pull requests

1 participant