@@ -57,8 +57,8 @@ class WechatChannel(Channel): | |||||
# handle_* 系列函数处理收到的消息后构造context,然后调用handle函数处理context | # handle_* 系列函数处理收到的消息后构造context,然后调用handle函数处理context | ||||
# context是一个字典,包含了消息的所有信息,包括以下key | # context是一个字典,包含了消息的所有信息,包括以下key | ||||
# type: 消息类型,包括TEXT、VOICE、IMAGE_CREATE | |||||
# content: 消息内容,如果是TEXT类型,content就是文本内容,如果是VOICE类型,content就是语音文件名,如果是IMAGE_CREATE类型,content就是图片生成命令 | |||||
# type 消息类型, 包括TEXT、VOICE、IMAGE_CREATE | |||||
# content 消息内容,如果是TEXT类型,content就是文本内容,如果是VOICE类型,content就是语音文件名,如果是IMAGE_CREATE类型,content就是图片生成命令 | |||||
# session_id: 会话id | # session_id: 会话id | ||||
# isgroup: 是否是群聊 | # isgroup: 是否是群聊 | ||||
# msg: 原始消息对象 | # msg: 原始消息对象 | ||||
@@ -38,7 +38,7 @@ class Banwords(Plugin): | |||||
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context | self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context | ||||
logger.info("[Banwords] inited") | logger.info("[Banwords] inited") | ||||
except Exception as e: | except Exception as e: | ||||
logger.error("Banwords init failed: %s" % e) | |||||
logger.warn("Banwords init failed: %s" % e) | |||||
@@ -6,8 +6,8 @@ import os | |||||
from common.singleton import singleton | from common.singleton import singleton | ||||
from common.sorted_dict import SortedDict | from common.sorted_dict import SortedDict | ||||
from .event import * | from .event import * | ||||
from .plugin import * | |||||
from common.log import logger | from common.log import logger | ||||
from config import conf | |||||
@singleton | @singleton | ||||
@@ -62,7 +62,11 @@ class PluginManager: | |||||
if os.path.isfile(main_module_path): | if os.path.isfile(main_module_path): | ||||
# 导入插件 | # 导入插件 | ||||
import_path = "{}.{}.{}".format(plugins_dir, plugin_name, plugin_name) | import_path = "{}.{}.{}".format(plugins_dir, plugin_name, plugin_name) | ||||
main_module = importlib.import_module(import_path) | |||||
try: | |||||
main_module = importlib.import_module(import_path) | |||||
except Exception as e: | |||||
logger.warn("Failed to import plugin %s: %s" % (plugin_name, e)) | |||||
continue | |||||
pconf = self.pconf | pconf = self.pconf | ||||
new_plugins = [] | new_plugins = [] | ||||
modified = False | modified = False | ||||
@@ -119,7 +119,7 @@ class Role(Plugin): | |||||
e_context.action = EventAction.CONTINUE | e_context.action = EventAction.CONTINUE | ||||
def get_help_text(self): | def get_help_text(self): | ||||
help_text = "输入\"$角色 (角色名)\"或\"$role (角色名)\"为我设定角色吧,$停止扮演 可以清除设定的角色。\n目前可用角色列表:\n" | |||||
help_text = "输入\"$角色 (角色名)\"或\"$role (角色名)\"为我设定角色吧,#reset 可以清除设定的角色。\n\n目前可用角色列表:\n" | |||||
for role in self.roles: | for role in self.roles: | ||||
help_text += f"[{role}]: {self.roles[role]['remark']}\n" | help_text += f"[{role}]: {self.roles[role]['remark']}\n" | ||||
return help_text | return help_text |