Skip to content

Problem with obtaining SenderId #227

Answered by ForNeVeR
cherryymerryy asked this question in Q&A
Discussion options

You must be logged in to vote

Depending on its type (MessageSenderChat or MessageSenderUser), pick the property UserId or ChatId.

Something like this:

// MessageSender sender
long id = sender switch {
  MessageSenderChat c => c.ChatId,
  MessageSenderUser u => u.UserId,
  _ => throw new Exception("oops")
};

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cherryymerryy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #226 on August 01, 2024 21:07.