diff --git a/commands/core.py b/commands/core.py index a7852d53..83bb9d8c 100644 --- a/commands/core.py +++ b/commands/core.py @@ -46,7 +46,7 @@ def tuling123(args_text, ctx_msg, internal=False): @cr.register('help', '帮助', '用法', '使用帮助', '使用指南', '使用说明', '使用方法', '怎么用') def help(_, ctx_msg): echo( - '你好!我是 CCZU 小开机器人,由常州大学开发者协会开发。\n' + '你好%s!我是 CCZU 小开机器人,由常州大学开发者协会开发。\n' '我可以为你做一些简单的事情,如发送知乎日报内容、翻译一段文字等。\n' '下面是我现在能做的一些事情:\n\n' '(1)/查天气 常州\n' @@ -61,6 +61,6 @@ def help(_, ctx_msg): '(10)/聊天 你好啊\n\n' '把以上内容之一(包括斜杠,不包括序号,某些部分替换成你需要的内容)发给我,我就会按你的要求去做啦。\n' '上面只给出了 10 条功能,还有更多功能和使用方法,请查看 http://t.cn/RIr177e\n\n' - '祝你使用愉快~', + '祝你使用愉快~' % (',' + ctx_msg.get('sender') if ctx_msg.get('sender') else ''), ctx_msg ) diff --git a/filters/how_to_use_1.py b/filters/how_to_use_1.py index 43e18acc..32c07fef 100644 --- a/filters/how_to_use_1.py +++ b/filters/how_to_use_1.py @@ -1,14 +1,20 @@ +import re + from filter import as_filter from commands import core @as_filter(priority=1) def _print_help_message(ctx_msg): - a = ['help', '怎么用', '怎么用啊', '你好', '你好啊', '帮助', + a = ['help', '怎么用', '怎么用啊', '你好', '你好啊', '你好呀', '帮助', '用法', '使用帮助', '使用指南', '使用说明', '使用方法', '你能做什么', '你能做些什么', '你会做什么', '你会做些什么', '你可以做什么', '你可以做些什么'] - if ctx_msg.get('text', '').strip() in a: + text = ctx_msg.get('text', '').strip() + sender = ctx_msg.get('sender', '') + if text in a or re.match('^' + sender + '刚刚把你添加到通讯录,现在可以开始聊天了。$', text): core.help('', ctx_msg) return False + elif re.match('^你已添加了' + sender + ',现在可以开始聊天了。$', text): + return False return True