-
-
Notifications
You must be signed in to change notification settings - Fork 885
Add class helper ChatAction #803
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
Conversation
Updated. Change using helper to using enum.Enum. Small test code: from aiogram.types.chat_action import ChatAction
from aiogram import types
import aiogram
async def main():
assert types.ChatAction == ChatAction
assert aiogram.types.ChatAction == ChatAction
assert aiogram.types.ChatAction.TYPING == ChatAction.TYPING
assert ChatAction.TYPING == "typing"
print("Import tests passed.")
from aiogram import Bot
BOT_TOKEN = "" # bot token here
CHAT_ID = 0 # user id to send action
bot = Bot(BOT_TOKEN)
await bot.send_chat_action(chat_id=CHAT_ID, action=ChatAction.TYPING)
await bot.send_chat_action(chat_id=CHAT_ID, action="typing")
await bot.session.close()
print("Implementation tests passed.")
if __name__ == '__main__':
import asyncio
loop = asyncio.get_event_loop()
loop.run_until_complete(main()) |
@ShiroNoHaga, please add tests to |
@evgfilim1 , added tests. |
This comment has been minimized.
This comment has been minimized.
Codecov Report
@@ Coverage Diff @@
## dev-3.x #803 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 301 303 +2
Lines 8150 8171 +21
=========================================
+ Hits 8150 8171 +21
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
norm
✔️ Changelog found.Thank you for adding a description of the changes |
@evgfilim1, don't forget to add it to 2x->3x migration guide |
This comment was marked as resolved.
This comment was marked as resolved.
|
Description
Add class helper ChatAction for constants that Telegram BotAPI uses in send_chat_action request.
In my opinion, this will help users and will also improve compatibility with 2.x version.
Difference from 2.x version:
• No class methods;
• Renamed
ChatActions
toChatAction
;• Better class description.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Testing code:
Test Configuration:
Checklist: