pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

ChatMemberUpdated

Open AbolfazlRezayi opened this issue 5 years ago • 9 comments

We need https://core.telegram.org/bots/api#chatmemberupdated

AbolfazlRezayi avatar May 24 '21 00:05 AbolfazlRezayi

@eternnoir Any plan for this major feature? can I work on it?

i-Naji avatar May 25 '21 13:05 i-Naji

@i-Naji You can work on it. Everybody can work on it. But nobody works. Thus the progress is quite slow.

Badiboy avatar May 25 '21 16:05 Badiboy

@i-Naji I added it today. Hope it will be merged :)

SwissCorePy avatar Jun 19 '21 18:06 SwissCorePy

@SwissCorePy @Badiboy Give an example of how ChatMember works.

I tried but it did not work. Python Ver = 3.8

Which handler should we use? Thanks♥

AbolfazlRezayi avatar Jun 22 '21 23:06 AbolfazlRezayi

@SwissCorePy @Badiboy Give an example of how ChatMember works.

I tried but it did not work. Python Ver = 3.8

Which handler should we use? Thanks♥

Sorry there was no handler yet. but i added it now. just wait until it is merged.

@bot.my_chat_member_handler()
def my_chat_member_update(cmu: types.ChatMemberUpdated):
  # The bot's chat member status was updated in a chat.
  print (cmu.from_user) # User : The admin who changed the bot's status
  print (cmu.old_chat_member) # ChatMember : The bot's previous status
  print (cmu.new_chat_member) # ChatMember : The bot's new status

@bot.chat_member_handler()
def chat_member_update(cmu: types.ChatMemberUpdated):
  # A chat member's status was updated in a chat.
  print (cmu.from_user) # User : The admin who changed a member's status
  print (cmu.old_chat_member) # ChatMember : The member's previous status
  print (cmu.new_chat_member) # ChatMember : The member's new status

SwissCorePy avatar Jun 23 '21 14:06 SwissCorePy

@SwissCorePy Hello, Thank you for your efforts♥ The code you sent is completely correct and there is no problem. But this code only works on one of my tokens. But on my other tokens I do not receive an answer. :(( We also tested on different accounts with different tokens, but just one of the tokens will work.

Botfather settings are all the same.

What do you think is the problem? If you need more information, enter your Telegram ID.

{'user': {'id': 785493292, 'is_bot': False, 'first_name': 'Uranus', 'username': 'uraous', 'last_name': None, 'language_code': 'en', 'can_join_groups': None, 'can_read_all_group_messages': None, 'supports_inline_queries': None}, 'status': 'member', 'custom_title': None, 'is_anonymous': None, 'can_be_edited': None, 'can_post_messages': None, 'can_edit_messages': None, 'can_delete_messages': None, 'can_restrict_members': None, 'can_promote_members': None, 'can_change_info': None, 'can_invite_users': None, 'can_pin_messages': None, 'is_member': None, 'can_send_messages': None, 'can_send_media_messages': None, 'can_send_polls': None, 'can_send_other_messages': None, 'can_add_web_page_previews': None, 'can_manage_chat': None, 'can_manage_voice_chats': None, 'until_date': None}

AbolfazlRezayi avatar Jun 24 '21 16:06 AbolfazlRezayi

@SwissCorePy Hello, Thank you for your efforts♥ The code you sent is completely correct and there is no problem. But this code only works on one of my tokens. But on my other tokens I do not receive an answer. :(( We also tested on different accounts with different tokens, but just one of the tokens will work.

Botfather settings are all the same.

What do you think is the problem? If you need more information, enter your Telegram ID.

{'user': {'id': 785493292, 'is_bot': False, 'first_name': 'Uranus', 'username': 'uraous', 'last_name': None, 'language_code': 'en', 'can_join_groups': None, 'can_read_all_group_messages': None, 'supports_inline_queries': None}, 'status': 'member', 'custom_title': None, 'is_anonymous': None, 'can_be_edited': None, 'can_post_messages': None, 'can_edit_messages': None, 'can_delete_messages': None, 'can_restrict_members': None, 'can_promote_members': None, 'can_change_info': None, 'can_invite_users': None, 'can_pin_messages': None, 'is_member': None, 'can_send_messages': None, 'can_send_media_messages': None, 'can_send_polls': None, 'can_send_other_messages': None, 'can_add_web_page_previews': None, 'can_manage_chat': None, 'can_manage_voice_chats': None, 'until_date': None}

The token should make no difference. But chat member updates are not requested by default. So you have to set the new allowed_updates parameter in polling()/infintity_polling(). If you want allow all update types. just use bot.polling(allowed_updates=util.update_types).

SwissCorePy avatar Jun 25 '21 10:06 SwissCorePy

The token should make no difference. But chat member updates are not requested by default. So you have to set the new allowed_updates parameter in polling()/infintity_polling(). If you want allow all update types. just use bot.polling(allowed_updates=util.update_types).

Yes it worked :D thanks for your help ♥

AbolfazlRezayi avatar Jun 25 '21 17:06 AbolfazlRezayi

The token should make no difference. But chat member updates are not requested by default. So you have to set the new allowed_updates parameter in polling()/infintity_polling(). If you want allow all update types. just use bot.polling(allowed_updates=util.update_types).

Yes it worked :D thanks for your help ♥

You're welcome :) I think this can be closed

SwissCorePy avatar Jun 25 '21 17:06 SwissCorePy