-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
contact alias not sync after call contact.alias(string) to set alias #1517
Comments
Good catch. Please try v0.19.119 or above, it should be solved. |
Another might be slimier issue/bug is if a new friends just being add. 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)
}) After 10s, it should force refrash contact for new add friends as well. |
It's great that you pointed this out. I suggest we should create another issue for this, and would you like to send a PR to fix this? because you already had the code above. |
Please close this issue after it's done, thanks. |
Yes, I just confirmed this issue has been fix. |
What did you mean I do not think the |
I am sorry for mistypo, what I mean is bot's friends change name |
Yes, currently we are leaking of the events that notice the bot of those changes. Hope this situation can be changed in the future. |
Nice. This bug has been fix |
Provide Your Network Information
U.S.
own machine
Run
npm run doctor
orwechaty run doctor
(for docker user), paste output here//docker run in container
const old_alias = await contact.alias()
const new_alias= "new_alias"
console.log(old_alias) // old_alias
await contact.alias(new_alias)
await contact.sync()
await delay(getRandomIntInclusive(3000, 5000)) // delay 3~5 secs
const new_set_alias = await contact.alias()
console.log(contact.name() + ' Alias:' + new_set_alias ) //contact name Alias: old_alias
Expected behavior
The contact alias should be set to new_alias in the wechaty after call alias()
Actual behavior
The contact alias not be set to new_alias in the Wechaty after call alias()
It still keep the old alias().
NOTE: this also happen when new friend being added, and it only be correct alias after Wechaty docker restart
Steps to reproduce the behavior (and fixes, if any)
None for now.
It may be sync issue with cache.
Full Output Logs
Show Logs
Paste the full output logs here with
WECHATY_LOG=silly
setThe text was updated successfully, but these errors were encountered: