wechaty / dotnet-wechaty

.NET Wechaty is a Conversational SDK for Chatbot Makers Written in C#
Apache License 2.0
81 stars 29 forks source link

NetCore8,调用say方法,报错:no payload #44

Open iarthit opened 6 months ago

iarthit commented 6 months ago

如图所示: VeryCapture_20240508224008

我哪里写错了吗?还是用法不对。

但实际上消息已经发出去了,我也收到了。

dosubot[bot] commented 6 months ago

The "no payload" error you're encountering when calling the say method likely stems from deeper within the Wechaty framework or its underlying puppet implementation, rather than the presence or absence of users named "test" in context.Users. This error could be related to several factors, including unsupported Sayable types, missing or incorrect payload data, issues in creating new instances of Contact, Location, MiniProgram, UrlLink, or Post from the payload, or unhandled promise rejections in asynchronous operations.

The say method itself, as shown in your description, does not perform error handling that would directly result in a "no payload" error. It's possible that the error arises from the specific implementation of currentUser.say or from the underlying logic that handles message sending, which checks for payload validity or user existence.

Regarding the context.Users collection returning a count of 0 for users with the name "test", this could be due to the Wechaty instance not being started, no users with the name "test" existing within the scope of your search, incorrect implementation or usage of user modules, or restrictions based on Wechaty's permissions and user privacy settings.

To diagnose the "no payload" error further, more specific details about your implementation, including how you handle errors and the message sending logic, would be necessary.

#### Details **Sources** - [src/wechaty/wechaty-base.ts](https://github.com/wechaty/wechaty/blob/main/src/wechaty/wechaty-base.ts) - [src/user-modules/contact.ts](https://github.com/wechaty/wechaty/blob/main/src/user-modules/contact.ts) - [src/user-mixins/validation.ts](https://github.com/wechaty/wechaty/blob/main/src/user-mixins/validation.ts) - [src/sayable/payload-to-sayable.ts](https://github.com/wechaty/wechaty/blob/main/src/sayable/payload-to-sayable.ts) - [src/wechaty-mixins/gerror-mixin.ts](https://github.com/wechaty/wechaty/blob/main/src/wechaty-mixins/gerror-mixin.ts) - [src/sayable/message-to-sayable.ts](https://github.com/wechaty/wechaty/blob/main/src/sayable/message-to-sayable.ts) - [src/wechaty-mixins/wechatify-user-module-mixin.ts](https://github.com/wechaty/wechaty/blob/main/src/wechaty-mixins/wechatify-user-module-mixin.ts)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

huan commented 6 months ago

@dosubot It is good to know that you can read images; You are doing a magnificent job!

dosubot[bot] commented 6 months ago

I appreciate the kind words! If there's anything more I can assist with or any further questions, feel free to let me know.

#### Details **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

dosubot[bot] commented 6 months ago

I appreciate the kind words! If there's anything more I can assist with or any further questions, feel free to let me know.

#### Details **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

dosubot[bot] commented 6 months ago

I appreciate the kind words! If there's anything more I can assist with or any further questions, feel free to let me know.

#### Details **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

huan commented 6 months ago

@dosubot Do you know that you are repeating yourself?

iarthit commented 6 months ago

@dosubot 你的意思不是我的问题?