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

new contact information not sync after contact being add via friendship event #1521

Closed
kis87988 opened this issue Aug 2, 2018 · 7 comments
Closed

Comments

@kis87988
Copy link
Contributor

kis87988 commented Aug 2, 2018

Provide Your Network Information

  1. Where is the location of your server? (i.e. City, or In/Out China)
    U.S.
  2. Which cloud platform(AliYun/Qcloud/DigitalOcean/etc) are you using?
    own machine

Run npm run doctor or wechaty run doctor(for docker user), paste output here

docker run in container

Expected behavior

bot.on('friendship', async friendship =>
{
    let logMsg
    try
    {
        logMsg = 'received `friend` event from ' + friendship.contact().name()
        console.log(logMsg)
        switch (friendship.type())
        {
            case Friendship.Type.Receive:
                logMsg = 'accepted automatically'
                await delay(10000)
                await friendship.accept()      
                break
            case Friendship.Type.Confirm:
                logMsg = 'friend ship confirmed with ' + friendship.contact().name()
                await delay(10000)
                await friendship.contact().sync()
                let fs = await friendship.contact().friend()
                console.log(fs) //////////////// false, but it should be true
                break
        }
    } catch (e)
    {
      logMsg = e.message
    }
    console.log(logMsg)
})

Actual behavior

console.log(fs) / return false, but it should be true

Steps to reproduce the behavior (and fixes, if any)

After friend being add wechaty should refrash contact cache and change the friendship between with bot and new_contact (means new contact cache should fetch again because all information change after add new friend).

this may be same issue as #1517

Full Output Logs

None available for this time

$ docker create -t -i --name=$docker_name \
--mount type=bind,source="${dir}",target=/bot \
-e WECHATY_LOG=silly \
-e TZ="America/Los_Angeles" \
zixia/wechaty:latest mybot.ts
$ docker start -a $docker_name 
Show Logs

Paste the full output logs here with WECHATY_LOG=silly set

# PASTE FULL LOG OUTPUT AT HERE:


@huan
Copy link
Member

huan commented Aug 2, 2018

Good catch!

And it would be terrific if you can fix this problem by sending a PR, would you like to do that?

@kis87988
Copy link
Contributor Author

kis87988 commented Aug 3, 2018

I would try:)

@huan
Copy link
Member

huan commented Aug 19, 2018

@kis87988 Did you get any progress about the PR to fix this issue?

Would love to hear back from you!

@kis87988
Copy link
Contributor Author

@zixia
Not really, no luck.
I tried to do sync() in the accept() function, but that doesn't work 😢

@huan
Copy link
Member

huan commented Aug 19, 2018

Do you think we have to set the contact.payload.friend = true directly for a workaround?

@kis87988
Copy link
Contributor Author

kis87988 commented Aug 19, 2018

But If I did sync(), it should make payload dirty, should it also give me right result? because it pulls data from puppet
However,
I am not sure for contact.payload.friend = true becasue it is okay in Wechaty, but if puppet send out confirm but fail. The puppet and Wechaty may not be consistent.

Maybe I am really wrong 😞

Copy link

dosubot bot commented Nov 14, 2023

Hi, @kis87988! I'm Dosu, and I'm helping the wechaty team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you reported an issue where the new contact's information is not syncing after adding them via a friendship event. Huan suggested that you fix the problem by sending a pull request (PR). However, it seems that you haven't made any progress with the PR. You also tried using the sync() function in the accept() function as a workaround, but it didn't work. Huan then suggested setting contact.payload.friend = true directly as a possible workaround, which seems to have resolved the issue.

Before we close this issue, could you please confirm if this issue is still relevant to the latest version of the wechaty repository? If it is, please let us know by commenting on this issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your contribution and for using wechaty!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Nov 14, 2023
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2023
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants