问题描述
我是python的新手,我想使用一个类的实例作为函数的参数,例如以下代码:
bot.py
from Bot import Qhttp,Event
import func
bot = Qhttp()
@bot.on('message')
async def _Msg(event: Event):
print(event.message)
await func.dosomething(event)
bot.run(hots='0.0.0.0',port=23456)
func.py
async def dosomething(event):
print(event.message)
Qhttp是一个基于Quart开发的对象,可以接收http帖子信息。
message
是事件对象中的字符串。
在async def _Msg(event: Event):
中,字符串可以正常打印,但是在async def dosomething(event):
中,我无法获取字符串。它会打印:
functools.partial(<bound method Qhttp.call_action of <Bot.Qhttp object at 0xMEMORYADDRESS>>,'message')
如何访问message
中的async def dosomething(event):
字符串?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)