问题描述
我需要检查频道中的最后一条消息是否为图片。如果消息中包含图像,则需要将该图像另存为变量以供以后使用。 (在这种情况下,tesseract.image_to_string)。我有此代码,但无法正常工作。
async def get_mess():
limit = 1
global new
global img
async for message in client.iter_messages('SAMPLE CHANNEL',limit):
if message.text is not None:
new = message.text
if message.photo in not None:
img = message.photo
return message
client.loop.run_until_complete(get_mess())
cv2.imshow('Image',img)
当我使用此代码时,它不起作用,因为我可以看到我的最后一条消息仅为图像,而我仍然无法使用它。我认为问题将在于将图像另存为变量。有人可以帮助我吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)