Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Full Support for Bot API 8.2 #4633

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

Merged
merged 11 commits into from
Jan 3, 2025
Merged

Full Support for Bot API 8.2 #4633

merged 11 commits into from
Jan 3, 2025

Conversation

Poolitzer
Copy link
Member

@Poolitzer Poolitzer commented Jan 1, 2025

I am surprised no test failed when I deprecated the hide_url argument, but I am too tired rn to decide if that is good/bad or if I already fixed it.

Copy link

codecov bot commented Jan 1, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
6573 2 6571 481
View the top 2 failed tests by shortest run time
tests.test_bot.TestBotWithRequest::test_get_set_my_default_administrator_rights
Stack Traces | 0.786s run time
self = <tests.test_bot.TestBotWithRequest object at 0x0000028C39852230>
bot = PytestExtBot[token=695104088:AAHfzylIOjSIIS-eOnI20y2E20HodHsfz-0]

    async def test_get_set_my_default_administrator_rights(self, bot):
        # Test that my default administrator rights for group are as all False
        assert await bot.set_my_default_administrator_rights()  # clear any set rights
        my_admin_rights_grp = await bot.get_my_default_administrator_rights()
        assert isinstance(my_admin_rights_grp, ChatAdministratorRights)
        assert all(not getattr(my_admin_rights_grp, at) for at in my_admin_rights_grp.__slots__)
    
        # Test setting my default admin rights for channel
        my_rights = ChatAdministratorRights.all_rights()
        assert await bot.set_my_default_administrator_rights(my_rights, for_channels=True)
        my_admin_rights_ch = await bot.get_my_default_administrator_rights(for_channels=True)
>       assert my_admin_rights_ch.can_invite_users is my_rights.can_invite_users
E       assert False is True
E        +  where False = ChatAdministratorRights(can_change_info=False, can_delete_messages=False, can_delete_stories=False, can_edit_messages=False, can_edit_stories=False, can_invite_users=False, can_manage_chat=False, can_manage_video_chats=False, can_post_messages=False, can_post_stories=False, can_promote_members=False, can_restrict_members=False, is_anonymous=False).can_invite_users
E        +  and   True = ChatAdministratorRights(can_change_info=True, can_delete_messages=True, can_delete_stories=True, can_edit_messages=True, can_edit_stories=True, can_invite_users=True, can_manage_chat=True, can_manage_topics=True, can_manage_video_chats=True, can_pin_messages=True, can_post_messages=True, can_post_stories=True, can_promote_members=True, can_restrict_members=True, is_anonymous=True).can_invite_users

tests\test_bot.py:3900: AssertionError
tests.test_bot.TestBotWithRequest::test_send_close_date_default_tz[UTC-timezone]
Stack Traces | 5.21s run time
self = <tests.test_bot.TestBotWithRequest object at 0x000001B2D7987350>
tz_bot = PytestExtBot[token=1047326771:AAF8nOt81FpX8lbbvz8UewQQvRfTbFfBvuI]
super_group_id = '-1001484797612'

    async def test_send_close_date_default_tz(self, tz_bot, super_group_id):
        question = "Is this a test?"
        answers = ["Yes", "No", "Maybe"]
        reply_markup = InlineKeyboardMarkup.from_button(
            InlineKeyboardButton(text="text", callback_data="data")
        )
    
        aware_close_date = dtm.datetime.now(tz=tz_bot.defaults.tzinfo) + dtm.timedelta(seconds=5)
        close_date = aware_close_date.replace(tzinfo=None)
    
        msg = await tz_bot.send_poll(  # The timezone returned from this is always converted to UTC
            chat_id=super_group_id,
            question=question,
            options=answers,
            close_date=close_date,
            read_timeout=60,
        )
        msg.poll._unfreeze()
        # Sometimes there can be a few seconds delay, so don't let the test fail due to that-
>       msg.poll.close_date = msg.poll.close_date.astimezone(aware_close_date.tzinfo)
E       AttributeError: 'NoneType' object has no attribute 'astimezone'

tests\test_bot.py:2750: AttributeError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link
Member

@harshil21 harshil21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly looks quite good!

@harshil21 harshil21 added the ⚙️ bot-api affected functionality: bot-api label Jan 1, 2025
@Bibo-Joshi Bibo-Joshi changed the title Api 8.2 Full Support for Bot API 8.2 Jan 2, 2025
Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for the nice & quick PR. I left only a few nitpicks :)

Copy link
Member

@harshil21 harshil21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo^2

@Bibo-Joshi Bibo-Joshi merged commit f2dc017 into master Jan 3, 2025
26 checks passed
@Bibo-Joshi Bibo-Joshi deleted the api_8.2 branch January 3, 2025 10:39
@Bibo-Joshi
Copy link
Member

Thanks again for the fast PR! I'll get the release started

@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
⚙️ bot-api affected functionality: bot-api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants