listen wechaty event Args: event: the event name, see at `WechatyEventName`. listener: the function bind to event name, see at `WechatyEventFunction`. Examples: Event:scan >>> bot.on('scan', lambda qrcode, status: print(qrcode,
(self, event: str, f: Callable[..., Any] = None)
| 301 | return self._name |
| 302 | |
| 303 | def on(self, event: str, f: Callable[..., Any] = None) -> Wechaty: # type: ignore |
| 304 | """ |
| 305 | listen wechaty event |
| 306 | Args: |
| 307 | event: the event name, see at `WechatyEventName`. |
| 308 | listener: the function bind to event name, see at `WechatyEventFunction`. |
| 309 | Examples: |
| 310 | Event:scan |
| 311 | >>> bot.on('scan', lambda qrcode, status: print(qrcode, status)) |
| 312 | >>> bot.start() |
| 313 | Returns: |
| 314 | Wechaty: self |
| 315 | """ |
| 316 | log.info('on() listen event <%s> with <%s>', event, f) |
| 317 | super().on(event, f) |
| 318 | return self |
| 319 | |
| 320 | def emit(self, event: str, *args: Any, **kwargs: Any) -> bool: |
| 321 | """ |
no outgoing calls
no test coverage detected