Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement basic ding-dong bot #39

Merged
merged 7 commits into from
May 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ clean:
.PHONY: lint
lint: pylint pycodestyle flake8 mypy pytype


# disable: TODO list temporay
.PHONY: pylint
pylint:
pylint \
--load-plugins pylint_quotes \
--disable=W0511 \
$(SOURCE_GLOB)

.PHONY: pycodestyle
Expand All @@ -52,8 +55,8 @@ mypy:

.PHONE: pytype
pytype:
pytype src/
pytype examples/
pytype src/ --disable=import-error
pytype examples/ --disable=import-error

.PHONY: install
install:
Expand Down
7 changes: 6 additions & 1 deletion examples/ding-dong-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import asyncio
from wechaty import Wechaty
from wechaty.user import Message
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we export Message in our module root? Because it will be convenience for the developers using, and that's also what we did in TS:

from wechaty import (
  Wechaty,
  Message,
)

from wechaty_puppet import PuppetOptions
from wechaty_puppet_hostie import HostiePuppet


async def message(msg: Message):
Expand All @@ -19,7 +21,10 @@ async def do_some_thing():
print(friends)
print('dong some thing')

bot = Wechaty(token='your-token-here').on('message', message)

# puppet_options = PuppetOptions(token='your-token-here')
hostie_puppet = HostiePuppet(PuppetOptions('your-token-here'), 'hostie-puppet')
bot = Wechaty(hostie_puppet).on('message', message)
Copy link
Member

@huan huan May 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the same argument as the TypeScript Wechaty?

bot = Wechaty({
  puppet: 'wechaty-puppet-hostie', 
  puppetOptions: { 
    token: 'the_token',
  },
})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will refactor it later.



async def main():
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ grpclib
pyee
requests
qrcode
chatie-grpc==0.15.dev4
requests
Loading