Open Lny-nice opened 3 years ago
You should upgrade the version of wechaty: wechaty~=0.7dev15
Please tell me more if you have try it.
Your service token has no available endpoint, is your token correct?' wechaty_puppet.exceptions.WechatyPuppetGrpcError: WechatyPuppetGrpcError('Your service token has no available endpoint, is your token correct?', None, None)
First, you should get the endpoint from https://api.chatie.io/v0/hosties/--your-token--
. If it is not accessible, you should contact the token provider to check the status of your token. If you use Padlocal
token, you should learn to start local server to provide local protocol service. Please refer to: https://github.com/wechaty/wechaty/discussions/1985
Second, if your endpoint is accessiable, please check the server grpc service status, so you can connect it with more happy.
If you also can't resolve your problem, you can try to restart your network, and provide more details info(token type, wechaty related package version, python version, os version, more ...) so we can help you resolve your problem.
thank you.
How to pull friends into WeChat group?
How to pull friends into WeChat group?
There are a lot of common Add
, Delete
features in Room
, Contact
, Friendship
, Tag
modules, and all of api name is same. You can refer to this issue, and try to write add
friend into WeChat Group.
Hope you can have more compression about wechaty. If you have any problems, please feel free to tell us.
python-wechaty好像文档也没有太完善 可以添加好友,但是不知道怎么拉入群,能给一段代码示例吗?
python-wechaty好像文档也没有太完善 可以添加好友,但是不知道怎么拉入群,能给一段代码示例吗?
https://github.com/wechaty/python-wechaty-getting-started/blob/master/examples/advanced/room_bot.py
Of course, there are a lot of on going improvements in wechaty.js.org website, which we are writing for polyglot wechaty.
Anyway, you can refer to this code: https://github.com/wechaty/python-wechaty-getting-started/blob/master/examples/advanced/room-member-bot.py
As you can see, there are a lot example bots in python-wechaty-getting-started. It's a great place you can learn.
你好,我运行这个文件结果就是把所有群的群成员打印在了控制台
async def on_ready(self, payload):
"""all of initialization jobs shoule be done here.
"""
log.info('ready event<%s>', payload)
# search contact and add them to the specific room
room: Optional[Room] = await self.Room.find(query=RoomQueryFilter(topic='room-topic-name'))
if not room:
return
contacts: List[Contact] = await self.Contact.find_all()
for contact in contacts:
await contact.ready()
if contact.name == 'your-friend-name':
await room.add(contact)
'your-friend-name': 这个是填写朋友备注呢还是什么 room-topic-name是群名称吗?
@lccnidaye your-friend-name
and room-topic-name
you can print the data of your friends & Room, so you will know the meaning of them. This is a basic skill that developers must master, you should have a try. Good luck to you.
@lccnidaye
your-friend-name
,room-topic-name
您可以打印朋友和房间的数据,因此您将了解它们的含义。这是开发人员必须掌握的一项基本技能,您应该尝试一下。祝你好运。
Room find() confirm room[#0] with id=17761739330@chatroom is valid result, return it.
Traceback (most recent call last): File "E:/python-wechaty/examples/ding-dong-bot-oop.py", line 7, in
from wechaty_puppet import FileBox # type: ignore
File "E:\python-wechaty\venv\lib\site-packages\wechaty_puppet__init__.py", line 6, in
from .schemas.types import ( # type: ignore
File "E:\python-wechaty\venv\lib\site-packages\wechaty_puppet\schemas\types.py", line 23, in
from chatie_grpc.wechaty import ( # type: ignore
File "E:\python-wechaty\venv\lib\site-packages\chatie_grpc\wechaty__init.py", line 7, in
import betterproto
File "E:\python-wechaty\venv\lib\site-packages\betterproto\ init__.py", line 27, in
import grpclib.client
File "E:\python-wechaty\venv\lib\site-packages\grpclib\client.py", line 26, in
from .protocol import H2Protocol, AbstractHandler, Stream as _Stream, Peer
File "E:\python-wechaty\venv\lib\site-packages\grpclib\protocol.py", line 22, in
from h2.events import StreamReset, PriorityUpdated, PingAcknowledged
ImportError: cannot import name 'PingAcknowledged' from 'h2.events' (E:\python-wechaty\venv\lib\site-packages\h2\events.py)