|
|
@@ -386,8 +386,14 @@ class LinkAIBot(Bot): |
|
|
|
def _send_image(self, channel, context, image_urls): |
|
|
|
if not image_urls: |
|
|
|
return |
|
|
|
max_send_num = conf().get("max_media_send_count") |
|
|
|
send_interval = conf().get("media_send_interval") |
|
|
|
try: |
|
|
|
i = 0 |
|
|
|
for url in image_urls: |
|
|
|
if max_send_num and i >= max_send_num: |
|
|
|
continue |
|
|
|
i += 1 |
|
|
|
if url.endswith(".mp4"): |
|
|
|
reply_type = ReplyType.VIDEO_URL |
|
|
|
elif url.endswith(".pdf") or url.endswith(".doc") or url.endswith(".docx"): |
|
|
@@ -399,6 +405,8 @@ class LinkAIBot(Bot): |
|
|
|
reply_type = ReplyType.IMAGE_URL |
|
|
|
reply = Reply(reply_type, url) |
|
|
|
channel.send(reply, context) |
|
|
|
if send_interval: |
|
|
|
time.sleep(send_interval) |
|
|
|
except Exception as e: |
|
|
|
logger.error(e) |
|
|
|
|
|
|
|