fromUser static method
- User? user,
- BaseChannel channel
Implementation
static Sender? fromUser(User? user, BaseChannel channel) {
if (user == null) return null;
final sender = Sender.fromJsonWithChat(channel.chat, user.toJson());
if (channel is GroupChannel) {
sender.role = channel.myRole;
} else if (channel is OpenChannel) {
sender.role = channel.isOperator(user.userId) ? Role.operator : Role.none;
}
return sender;
}