-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from wj-Mcat/master
implement basic ding-dong bot
- Loading branch information
Showing
50 changed files
with
3,212 additions
and
967 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,38 @@ | ||
#!/usr/bin/env python3.8 | ||
"""doc""" | ||
import asyncio | ||
|
||
from wechaty import Wechaty | ||
from wechaty.user import Message | ||
from wechaty_puppet import PuppetOptions | ||
from wechaty_puppet_hostie import HostiePuppet | ||
|
||
|
||
async def message(msg: Message): | ||
"""back on message""" | ||
from_contact = msg.talker() | ||
text = msg.text() | ||
if from_contact is not None and text == 'ding': | ||
await from_contact.say('dong') | ||
print(msg) | ||
|
||
|
||
async def do_some_thing(): | ||
"""do some thing""" | ||
friends = await bot.Contact.find_all() | ||
print(friends) | ||
print('dong some thing') | ||
|
||
|
||
# puppet_options = PuppetOptions(token='your-token-here') | ||
|
||
bot: Wechaty = None | ||
|
||
async def main(): | ||
"""doc""" | ||
print('hello') | ||
await asyncio.sleep(1) | ||
print('world') | ||
bot = Wechaty() | ||
print(await bot.name()) | ||
|
||
hostie_puppet = HostiePuppet(PuppetOptions('donut-test-user-6005'), | ||
'hostie-puppet') | ||
global bot | ||
bot = Wechaty(hostie_puppet).on('message', message) | ||
await bot.start() | ||
await do_some_thing() | ||
|
||
asyncio.run(main()) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ pylint-quotes | |
pytest | ||
pytype==2020.2.20 | ||
semver | ||
grpclib | ||
pyee | ||
requests | ||
qrcode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
grpclib | ||
pyee | ||
requests | ||
qrcode | ||
chatie-grpc==0.15.dev4 | ||
requests | ||
qrcode |
Oops, something went wrong.