def photo_from_telegram(bot: telegram.Bot,
update: telegram.Update):
if update.message:
message: telegram.Message = update.message
edited = False
else:
message: telegram.Message = update.edited_message
edited = True
tg_group_id = message.chat_id # telegram group id
forward_index = get_forward_index(tg_group_id=tg_group_id)
if edited:
recall_message(forward_index, message)
reply_entity = list()
file_id = message.photo[-1].file_id
pic_url = tg_get_pic_url(file_id, 'jpg')
if JQ_MODE:
reply_entity.append({
'type': 'image',
'data': {'file': file_id + '.jpg'}
})
if message.caption:
reply_entity.append({
'type': 'text',
'data': {'text': message.caption}
})
else:
if message.caption:
reply_entity.append({
'type': 'text',
'data': {'text': '[ ??, ?????' + pic_url + ' ]' + message.caption}
})
else:
reply_entity.append({
'type': 'text',
'data': {'text': '[ ??, ?????' + pic_url + ' ]'}
})
qq_message_id = send_from_tg_to_qq(forward_index,
message=reply_entity,
tg_group_id=tg_group_id,
tg_user=message.from_user,
tg_forward_from=message,
tg_reply_to=message.reply_to_message,
edited=edited)
global_vars.mdb.append_message(qq_message_id, message.message_id, forward_index, 0)
_1100_text_forward.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录