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

Use senderTimestampMs instead of messageTimestamp #348

Merged
merged 3 commits into from
Jan 19, 2024

Conversation

allburov
Copy link
Contributor

message.messageTimestamp contains timestamp in seconds, not in milliseconds as content.pollUpdateMessage.senderTimestampMs

It's important to get exact milliseconds for multi options poll, because we can get two message.update events with the same senderTimestampMs (because it's in seconds, not in milliseconds) so we can understand which vote is the latest one

Here's an event example:

{
    "messages.upsert": {
        "messages": [
            {
                "key": {...},
                "messageTimestamp": 1692774684,
                "message": {
                    "messageContextInfo": {...},
                    },
                    "pollUpdateMessage": {
                        "pollCreationMessageKey": {...},
                        "vote": {...},
                        "senderTimestampMs": "1692774684709"
                    }
                }
            }
        ],
        "type": "notify"
    },

There's .toNumber() because senderTimestampMs has Long type

{
  "low": 739148892,
  "high": 394,
  "unsigned": false
}

If we want to keep Long - let me know and I'll adjust the changes!

@whiskeysockets-bot
Copy link
Contributor

Thanks for your contribution.

The next step is to wait for review and approval to merge it to main repository

The community can help reacting with a thumb up (:thumbsup:) for approval and rocket (:rocket:) for who has tested it.

To test this PR you can run the following command below:

# NPM
npm install @whiskeysockets/baileys@allburov/Baileys#fix-vote-timestamp
# YARN v2
yarn add @whiskeysockets/baileys@allburov/Baileys#fix-vote-timestamp

@allburov
Copy link
Contributor Author

Let me know if I need to fix the "check-lint" type issues, I'll handle type it!

Copy link
Collaborator

@PurpShell PurpShell left a comment

Choose a reason for hiding this comment

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

Looks good

src/Utils/process-message.ts Outdated Show resolved Hide resolved
@PurpShell PurpShell merged commit 4ff3b32 into WhiskeySockets:master Jan 19, 2024
2 checks passed
laxeder pushed a commit to laxeder/Baileys that referenced this pull request Jan 20, 2024
* Use senderTimestampMs instead of messageTimestamp

* Add .toNumber(), because senderTimestampMs is Long

* chore: Fix linting

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
PurpShell added a commit that referenced this pull request Mar 12, 2024
* feat: Set in group settings memberAddMode and joinApprovalMode (#534)

* feat: Set in group settings memberAddMode and joinApprovalMode

* fix lint

* fix lint

* fix conflict

---------

Co-authored-by: Bob <115008575+FortisEtMagnus@users.noreply.github.com>
Co-authored-by: Bob <115008575+bobpetrov@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* feat: memberAddMode and joinApprovalMode in groups.update (#532)

* feat: memberAddMode and joinApprovalMode

* feat: memberAddMode and joinApprovalMode

* Update process-message.ts

* fix lint

* Update messages-recv.ts

* Update GroupMetadata.ts

* Update messages-recv.ts

* Update messages-recv.ts

* chore: fix linting and code efficiency

* fix lint

* Fix lint

* Update process-message.ts

* Update process-message.ts

---------

Co-authored-by: Bob <115008575+FortisEtMagnus@users.noreply.github.com>
Co-authored-by: Bob <115008575+bobpetrov@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* Update package.json (#506)

Any version of cache-manager greater than 4.0.1 stopped coming with an index.js resulting to 

`@whiskeysockets/baileys/node_modules/cache-manager/dist/index.js'. Please verify that the package.json has a valid "main" entry` error

* Use senderTimestampMs instead of messageTimestamp (#348)

* Use senderTimestampMs instead of messageTimestamp

* Add .toNumber(), because senderTimestampMs is Long

* chore: Fix linting

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* feat: add option for Windows browser (#303)

* chore(package.json): update protobufjs dependency from version 6.11.3 to 7.2.4 for compatibility and potential bug fixes (#302)

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* feat: auto version hash (#290)

* feat: auto version hash

* sort imports

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* chore: updated proto/version to v2.2403.2 (#288)

Co-authored-by: edgardmessias <edgardmessias@users.noreply.github.com>

* bump: sharp to ^0.32.2 (#245)

* feat: Add max msg retry count (#572)

* Update getDevice (#569)

Co-authored-by: Bob <115008575+bobpetrov@users.noreply.github.com>

* chore: Add more docs regarding status@broadcast messages

* Support for receiving "view once" audio messages (#595)

* Update size calculation in extractGroupMetadata function (#581)

* feat: If need approval to join the group in groupMetadata (#533)

* If need approval to join the group

* If need approval to join the group

* Update groups.ts

* Update groups.ts

* fix lint

* Update groups.ts

* Update groups.ts

---------

Co-authored-by: Bob <115008575+FortisEtMagnus@users.noreply.github.com>
Co-authored-by: Bob <115008575+bobpetrov@users.noreply.github.com>

* chore: fix typing (duplicate property due to overlapping PRs)

* chore: fix github action release

* chore: fix manual release action

* chore: revert changes to package.json

* fix: quick test to diagnose working dir issue

* fix yml syntax

* chore: fix yarn.lock

* chore: fix release workflow

* chore(release): v6.6.0

* Update FUNDING.yml

* chore: fix audio decode error due to passing spread argument

* Change the default browser to fix pairing code

---------

Co-authored-by: Bob <115008575+bobslavtriev@users.noreply.github.com>
Co-authored-by: Bob <115008575+FortisEtMagnus@users.noreply.github.com>
Co-authored-by: Bob <115008575+bobpetrov@users.noreply.github.com>
Co-authored-by: NOOB-KILLERBOT <79617162+chocolaid@users.noreply.github.com>
Co-authored-by: Alex <allburov@gmail.com>
Co-authored-by: Ashary Vermaysha <34608589+vermaysha@users.noreply.github.com>
Co-authored-by: ugurgungezerler <ugurgungezerler@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: edgardmessias <edgardmessias@users.noreply.github.com>
Co-authored-by: Muhammed Kaplan <mmuhammedkaplan0@gmail.com>
Co-authored-by: Alex Sandro <63991021+laxeder@users.noreply.github.com>
Co-authored-by: Javier Cuevas <javiercr@gmail.com>
Co-authored-by: Wender Teixeira <unktools@gmail.com>
Co-authored-by: ShellTear <shelltear1337@gmail.com>
Co-authored-by: Timothy Dillan <timothi.dillan10@gmail.com>
Co-authored-by: Pokoke <74485230+Pokoke-01@users.noreply.github.com>
Co-authored-by: Alessandro Autiero <alautiero@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants