Skip to content

Commit

Permalink
enable override for user_id
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-astra-via committed Aug 9, 2023
1 parent 7117a2b commit 8b6ab47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import UAParser from 'ua-parser-js'
// Get the user ID stored in the client, if it does not exist, make a random one, save it in the client, and return it.
const getUserId = (event: MCEvent) => {
const { client } = event
let userId = client.get('user_id')
let userId = event.payload.user_id || client.get('user_id')
if (!userId) {
userId = crypto.randomUUID()
client.set('user_id', userId, { scope: 'infinite' })
Expand Down

0 comments on commit 8b6ab47

Please sign in to comment.