linzhiming0826 / aiowerobot

一个基于sanic的异步微信公众号开发框架
3 stars 2 forks source link

how could i use asynchronous calls in handler? #2

Closed jcevo closed 1 year ago

jcevo commented 1 year ago

from aiowerobot import AioWeRoBot

robot = AioWeRoBot(app_id='', app_secret='', token='')

@robot.handler async def hello(message): return 'Hello World!'

config = {'host': '0.0.0.0', 'port': 8099} robot.run(**config)

linzhiming0826 commented 1 year ago
from aiowerobot import AioWeRoBot

robot = AioWeRoBot(app_id='', app_secret='', token='')

async def do():
    return

@robot.handler
async def hello(message):
    await do()
    return 'Hello World!'

config = {'host': '0.0.0.0', 'port': 8099}
robot.run(**config)