From dfdfe491901951b914cd8218cac670f1f2963814 Mon Sep 17 00:00:00 2001 From: wjmcat <1435130236@qq.com> Date: Wed, 2 Dec 2020 10:41:58 +0800 Subject: [PATCH 1/2] add auto-reply examples --- examples/auto-reply-bot.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/examples/auto-reply-bot.py b/examples/auto-reply-bot.py index e69de29..a2c17d0 100644 --- a/examples/auto-reply-bot.py +++ b/examples/auto-reply-bot.py @@ -0,0 +1,30 @@ +"""daily plugin bot examples""" +import asyncio +from datetime import datetime +from typing import List + +from wechaty import Wechaty # type: ignore +from wechaty_puppet import RoomQueryFilter # type: ignore + +from wechaty_plugin_contrib import ( + AutoReplyRule, + AutoReplyPlugin, + AutoReplyOptions +) + + +def get_rules() -> List[AutoReplyRule]: + return [ + AutoReplyRule(keyword='ding', reply_content='dong'), + AutoReplyRule(keyword='wechaty', reply_content='hello-wechaty') + ] + + +async def run(): + """async run method""" + + plugin = AutoReplyPlugin(AutoReplyOptions(rules=get_rules())) + bot = Wechaty().use(plugin) + await bot.start() + +asyncio.run(run()) From d21972e8c3b70c39565ac4572be6854e04c39b03 Mon Sep 17 00:00:00 2001 From: wjmcat <1435130236@qq.com> Date: Wed, 2 Dec 2020 10:43:47 +0800 Subject: [PATCH 2/2] fix example lint issue --- examples/auto-reply-bot.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/auto-reply-bot.py b/examples/auto-reply-bot.py index a2c17d0..7203027 100644 --- a/examples/auto-reply-bot.py +++ b/examples/auto-reply-bot.py @@ -1,10 +1,8 @@ """daily plugin bot examples""" import asyncio -from datetime import datetime from typing import List from wechaty import Wechaty # type: ignore -from wechaty_puppet import RoomQueryFilter # type: ignore from wechaty_plugin_contrib import ( AutoReplyRule, @@ -14,6 +12,7 @@ def get_rules() -> List[AutoReplyRule]: + """get the default auto-reply configuration""" return [ AutoReplyRule(keyword='ding', reply_content='dong'), AutoReplyRule(keyword='wechaty', reply_content='hello-wechaty')