Skip to content

Commit bd5737d

Browse files
authored
Merge pull request #1 from wechaty/master (#3)
* add auto-reply examples * fix example lint issue
1 parent 4ee5ba2 commit bd5737d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

examples/auto-reply-bot.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""daily plugin bot examples"""
2+
import asyncio
3+
from typing import List
4+
5+
from wechaty import Wechaty # type: ignore
6+
7+
from wechaty_plugin_contrib import (
8+
AutoReplyRule,
9+
AutoReplyPlugin,
10+
AutoReplyOptions
11+
)
12+
13+
14+
def get_rules() -> List[AutoReplyRule]:
15+
"""get the default auto-reply configuration"""
16+
return [
17+
AutoReplyRule(keyword='ding', reply_content='dong'),
18+
AutoReplyRule(keyword='wechaty', reply_content='hello-wechaty')
19+
]
20+
21+
22+
async def run():
23+
"""async run method"""
24+
25+
plugin = AutoReplyPlugin(AutoReplyOptions(rules=get_rules()))
26+
bot = Wechaty().use(plugin)
27+
await bot.start()
28+
29+
asyncio.run(run())

0 commit comments

Comments
 (0)