完成适配器化改造,所有上报数据统一、接口调用等都改成通过不同消息源的适配器来完成,插件和消息源的耦合

This commit is contained in:
Richard Chien
2017-02-15 15:52:18 +08:00
parent ecd446f057
commit 3508db348d
17 changed files with 383 additions and 221 deletions

View File

@ -1,5 +1,5 @@
from command import CommandRegistry
from apiclient import client as api
from msg_src_adapter import get_adapter_by_ctx
__registry__ = cr = CommandRegistry()
@ -9,7 +9,10 @@ def echo(args_text, ctx_msg, internal=False):
if internal:
return None
else:
return api.send_message(args_text, ctx_msg)
return get_adapter_by_ctx(ctx_msg).send_message(
target=ctx_msg,
content=args_text
)
@cr.register('help', '帮助', '用法', '使用帮助', '使用指南', '使用说明', '使用方法', '怎么用')