yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.45k stars 1.53k forks source link

Why my bot can't get 'new_chat_members' event when the group is over 10k members ? #923

Closed sekaiamber closed 2 years ago

sekaiamber commented 2 years ago

Hello, bro :)

I have a bot using to manage my group.

And when my group is under 10k members, when a new member join my group, everything work fine:

bot.on('message', (message, meta) => {
  console.log(meta)  // { type: "new_chat_members" }
})
bot.on('new_chat_members', (message, meta) => {
  console.log(message)  // Great
})

But when my group reach 10k members. bot can not get the 'new_chat_members' event, even 'message' event.

Any ideas?


By the way, I have tried #918 . Nothing changed.


My config:

const bot = new Bot(TOKEN, {
  polling: {
    params: {
      allowed_updates: [
        'update_id',
        'message',
        'edited_message',
        'channel_post',
        'edited_channel_post',
        'inline_query',
        'chosen_inline_result',
        'callback_query',
        'shipping_query',
        'pre_checkout_query',
        'poll',
        'poll_answer',
        'my_chat_member',
        'chat_member',
        'chat_join_request',
      ],
    },
  },
})
danielperez9430 commented 2 years ago
const bot = new TelegramBot(TOKEN, {
    polling: {
        params: {
            "allowed_updates": JSON.stringify(["update_id", "message", "edited_message", "channel_post", "edited_channel_post", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_member"])
        }
    }
});

Old version:

Hi @sekaiamber, first stop your bot and put this "url" in the browser. You only need to remplace <YOUR_BOT_TOKEN>, before that you can get the updates of the "chat_member". You don't need to pass any extra parameter in polling if you do it using this url. After that you can start your bot.

https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates?allowed_updates=["update_id","message","edited_message","channel_post","edited_channel_post","inline_query","chosen_inline_result","callback_query","shipping_query","pre_checkout_query","poll","poll_answer","my_chat_member","chat_member"]
Mrsayyed commented 2 years ago

I have this problem too please explain more

danielperez9430 commented 2 years ago

@Mrsayyed In summary "chat_member" is a optional update, but if you need this update you need to pass the array of "all updates" that you need. In the end the easy way to do is setup manual 1 time and you can get it easy

ljs19923 commented 1 year ago

Hey I have a problem around the same topic. For the same channel, for some invitation links, I got the chat_member update from Telegram and for some others users randomly around 10-30%, I don't receive updates... do you know an idea why?

Thanks a lot

I opened a bug https://bugs.telegram.org/c/27242

Screen Shot 2023-04-15 at 14 03 36