|
@@ -13,7 +13,7 @@ from config import conf |
|
|
import requests |
|
|
import requests |
|
|
import io |
|
|
import io |
|
|
|
|
|
|
|
|
thead_pool = ThreadPoolExecutor(max_workers=8) |
|
|
|
|
|
|
|
|
thread_pool = ThreadPoolExecutor(max_workers=8) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@itchat.msg_register(TEXT) |
|
|
@itchat.msg_register(TEXT) |
|
@@ -56,9 +56,9 @@ class WechatChannel(Channel): |
|
|
img_match_prefix = self.check_prefix(content, conf().get('image_create_prefix')) |
|
|
img_match_prefix = self.check_prefix(content, conf().get('image_create_prefix')) |
|
|
if img_match_prefix: |
|
|
if img_match_prefix: |
|
|
content = content.split(img_match_prefix, 1)[1].strip() |
|
|
content = content.split(img_match_prefix, 1)[1].strip() |
|
|
thead_pool.submit(self._do_send_img, content, from_user_id) |
|
|
|
|
|
|
|
|
thread_pool.submit(self._do_send_img, content, from_user_id) |
|
|
else: |
|
|
else: |
|
|
thead_pool.submit(self._do_send, content, from_user_id) |
|
|
|
|
|
|
|
|
thread_pool.submit(self._do_send, content, from_user_id) |
|
|
|
|
|
|
|
|
elif to_user_id == other_user_id and match_prefix: |
|
|
elif to_user_id == other_user_id and match_prefix: |
|
|
# 自己给好友发送消息 |
|
|
# 自己给好友发送消息 |
|
@@ -68,9 +68,9 @@ class WechatChannel(Channel): |
|
|
img_match_prefix = self.check_prefix(content, conf().get('image_create_prefix')) |
|
|
img_match_prefix = self.check_prefix(content, conf().get('image_create_prefix')) |
|
|
if img_match_prefix: |
|
|
if img_match_prefix: |
|
|
content = content.split(img_match_prefix, 1)[1].strip() |
|
|
content = content.split(img_match_prefix, 1)[1].strip() |
|
|
thead_pool.submit(self._do_send_img, content, to_user_id) |
|
|
|
|
|
|
|
|
thread_pool.submit(self._do_send_img, content, to_user_id) |
|
|
else: |
|
|
else: |
|
|
thead_pool.submit(self._do_send, content, to_user_id) |
|
|
|
|
|
|
|
|
thread_pool.submit(self._do_send, content, to_user_id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_group(self, msg): |
|
|
def handle_group(self, msg): |
|
@@ -95,9 +95,9 @@ class WechatChannel(Channel): |
|
|
img_match_prefix = self.check_prefix(content, conf().get('image_create_prefix')) |
|
|
img_match_prefix = self.check_prefix(content, conf().get('image_create_prefix')) |
|
|
if img_match_prefix: |
|
|
if img_match_prefix: |
|
|
content = content.split(img_match_prefix, 1)[1].strip() |
|
|
content = content.split(img_match_prefix, 1)[1].strip() |
|
|
thead_pool.submit(self._do_send_img, content, group_id) |
|
|
|
|
|
|
|
|
thread_pool.submit(self._do_send_img, content, group_id) |
|
|
else: |
|
|
else: |
|
|
thead_pool.submit(self._do_send_group, content, msg) |
|
|
|
|
|
|
|
|
thread_pool.submit(self._do_send_group, content, msg) |
|
|
|
|
|
|
|
|
def send(self, msg, receiver): |
|
|
def send(self, msg, receiver): |
|
|
logger.info('[WX] sendMsg={}, receiver={}'.format(msg, receiver)) |
|
|
logger.info('[WX] sendMsg={}, receiver={}'.format(msg, receiver)) |
|
|