From 52c0797230a294e6ff7815c71e00eec4d7032c92 Mon Sep 17 00:00:00 2001 From: luotuan Date: Sun, 26 Feb 2023 18:34:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E9=80=81=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channel/telegram/telegram_channel.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/channel/telegram/telegram_channel.py b/channel/telegram/telegram_channel.py index 3b8ced7..9ae0c64 100644 --- a/channel/telegram/telegram_channel.py +++ b/channel/telegram/telegram_channel.py @@ -1,4 +1,4 @@ -import json +from telebot import util from concurrent.futures import ThreadPoolExecutor import io import requests @@ -10,6 +10,9 @@ from config import channel_conf_val, channel_conf bot = telebot.TeleBot(token=channel_conf(const.TELEGRAM).get('bot_token')) thread_pool = ThreadPoolExecutor(max_workers=8) +@bot.message_handler(commands=['help']) +def send_welcome(message): + bot.send_message(message.chat.id, "

使用普通文本消息进行查询

‘画’开头使用绘画功能

", parse_mode = "HTML") @bot.message_handler(content_types=['text']) def send_welcome(msg): @@ -56,7 +59,9 @@ class TelegramChannel(Channel): # 图片发送 logger.info('[Telegrame] sendImage, receiver={}'.format(reply_user_id)) - bot.reply_to(msg, image_storage) + splitted_text = util.split_string(image_storage, 3000) + for text in splitted_text: + bot.send_message(msg.chat.id, text) except Exception as e: logger.exception(e)