Skip to content

Commit

Permalink
Resolve Incorrect Update.userId Assignment
Browse files Browse the repository at this point in the history
Referencing issue [#85](#85).

The problem arises because Go maps are unordered, and `getDifferent` is called before `fillUserIdFromMessage`. This sequence can lead to an incorrect `userId` being assigned to `Update.userId` due to inconsistent entity processing. Ensuring proper order of operations will resolve this.
  • Loading branch information
saiaapiz14 authored Oct 7, 2024
1 parent 0f6f5fb commit 157f54b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func GetNewUpdate(ctx context.Context, client *tg.Client, selfUserId int64, p *s
case *tg.UpdateNewMessage:
m := update.GetMessage()
u.EffectiveMessage = types.ConstructMessage(m)
u.fillUserIdFromMessage(selfUserId)
diff, err := client.UpdatesGetDifference(ctx, &tg.UpdatesGetDifferenceRequest{
Pts: update.Pts - 1,
Date: int(time.Now().Unix()),
Expand Down Expand Up @@ -70,7 +71,6 @@ func GetNewUpdate(ctx context.Context, client *tg.Client, selfUserId int64, p *s
}
}
}
u.fillUserIdFromMessage(selfUserId)
case message.AnswerableMessageUpdate:
m := update.GetMessage()
u.EffectiveMessage = types.ConstructMessage(m)
Expand Down

0 comments on commit 157f54b

Please sign in to comment.