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

Every class should be imported from wechaty repo #175

Open
wj-Mcat opened this issue Mar 7, 2021 · 0 comments
Open

Every class should be imported from wechaty repo #175

wj-Mcat opened this issue Mar 7, 2021 · 0 comments
Labels
🔥 enhancement New feature or request

Comments

@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Mar 7, 2021

Describe the bug
As described in : https://github.com/wechaty/wechaty.js.org/pull/684#discussion_r588297559

There are some class that are also imported from wechaty-puppet package, so we should fix them.

To Reproduce

  • example code:
from wechaty import Wechaty
from wechaty_puppet import EventReadyPayload
import asyncio

# method one
async def on_ready(payload: EventReadyPayload):
    """Any initialization work can be put in here
    Args:
        payload (EventReadyPayload): ready data
    """
    print(f'receive ready event<{payload}>')

bot = Wechaty()
bot.on('ready', on_ready)
asyncio.run(bot.start())

# method two (suggested)

class MyBot(Wechaty):
    async def on_ready(self, payload: EventReadyPayload):
        """Any initialization work can be put in here
        Args:
            payload (EventReadyPayload): ready data
        """
        print(f'receive ready event<{payload}>')
        
asyncio.run(MyBot().start())

We should keep ths

Additional context

@wj-Mcat wj-Mcat added the 🔥 enhancement New feature or request label Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔥 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant