-
public final class MessageKt
-
-
Method Summary
Modifier and Type Method Description final DategetNEVER()Internal indicator of a 'never' date. final static List<User>users(Message $self)Retrieves all Users involved in the message. final static List<Message>updateUsers(Collection<Message> $self, Map<String, User> users)Updates collection of messages with more recent data of users. final static Map<String, Message>updateUsers(Map<String, Message> $self, Map<String, User> users)Updates collection of messages with more recent data of users. final static MessageupdateUsers(Message $self, Map<String, User> users)Updates a message with more recent data of users. final static MessagewithMemberInfo(Message $self, MemberInfo memberInfo)Replaces the Message.member snapshot of this message, keeping the deprecated Message.channelRole in sync with it. final static BooleanhasOutdatedMemberInfo(Message $self, String userId, MemberInfo memberInfo)Whether this message, or the quoted message it carries, holds an out of date snapshot for userId, either as the author in Message.member or as one of the Message.mentionedChannelMembers. final static MessagewithRefreshedMemberInfo(Message $self, String userId, MemberInfo memberInfo)Applies memberInfo to this message and to the quoted message it carries, wherever userId appears on either of them: as the author, and as a mentioned user. final static MessagepopulateMentions(Message $self, Channel channel)Fills Message.mentionedUsersIds based on Message.text and Channel.members. final static BooleanwasCreatedAfterOrAt(Message $self, Date date)Checks if the message was created after or at the given date. final static BooleanwasCreatedAfter(Message $self, Date date)Checks if the message was created after the given date. final static BooleanwasCreatedBefore(Message $self, Date date)Checks if the message was created before the given date. final static BooleanwasCreatedBeforeOrAt(Message $self, Date date)Checks if the message was created before or at the given date. final static BooleanshouldIncrementUnreadCount(Message $self, String currentUserId, Date lastMessageAtDate, Boolean isChannelMuted)Function that parses if the unread count should be increased or not. final static BooleanhasPendingAttachments(Message $self)Checks if the given Message has pending attachments. -
-
Method Detail
-
users
final static List<User> users(Message $self)
Retrieves all Users involved in the message. Includes the author, reaction authors, original message author (if the message is reply), mentioned users, thread participants, pinned by user, and poll voters.
-
updateUsers
final static List<Message> updateUsers(Collection<Message> $self, Map<String, User> users)
Updates collection of messages with more recent data of users.
-
updateUsers
final static Map<String, Message> updateUsers(Map<String, Message> $self, Map<String, User> users)
Updates collection of messages with more recent data of users.
-
updateUsers
final static Message updateUsers(Message $self, Map<String, User> users)
Updates a message with more recent data of users. It updates author user, latestReactions, replyTo message, mentionedUsers, threadParticipants and pinnedBy user of this instance.
-
withMemberInfo
final static Message withMemberInfo(Message $self, MemberInfo memberInfo)
Replaces the Message.member snapshot of this message, keeping the deprecated Message.channelRole in sync with it.
The snapshot is taken verbatim: the same value reaches the in-memory state, the repository cache and the database, so the three cannot disagree. A blanket column update cannot preserve a previously known role, so neither does this.
-
hasOutdatedMemberInfo
final static Boolean hasOutdatedMemberInfo(Message $self, String userId, MemberInfo memberInfo)
Whether this message, or the quoted message it carries, holds an out of date snapshot for userId, either as the author in Message.member or as one of the Message.mentionedChannelMembers.
-
withRefreshedMemberInfo
final static Message withRefreshedMemberInfo(Message $self, String userId, MemberInfo memberInfo)
Applies memberInfo to this message and to the quoted message it carries, wherever userId appears on either of them: as the author, and as a mentioned user.
The quoted copy is a snapshot of its own, so leaving it behind would show two different snapshots for one user.
-
populateMentions
final static Message populateMentions(Message $self, Channel channel)
Fills Message.mentionedUsersIds based on Message.text and Channel.members.
It combines the users found in the input with pre-set Message.mentionedUsersIds, in case someone is manually added as a mention. Currently only searches through the channel members for possible mentions.
- Parameters:
channel- The channel whose members we can check for the mention.
-
wasCreatedAfterOrAt
final static Boolean wasCreatedAfterOrAt(Message $self, Date date)
Checks if the message was created after or at the given date.
-
wasCreatedAfter
final static Boolean wasCreatedAfter(Message $self, Date date)
Checks if the message was created after the given date.
-
wasCreatedBefore
final static Boolean wasCreatedBefore(Message $self, Date date)
Checks if the message was created before the given date.
-
wasCreatedBeforeOrAt
final static Boolean wasCreatedBeforeOrAt(Message $self, Date date)
Checks if the message was created before or at the given date.
-
shouldIncrementUnreadCount
final static Boolean shouldIncrementUnreadCount(Message $self, String currentUserId, Date lastMessageAtDate, Boolean isChannelMuted)
Function that parses if the unread count should be increased or not.
- Parameters:
currentUserId- The id of the user that the unread count should be evaluated.lastMessageAtDate- The Date of the last message the SDK is aware of.isChannelMuted- If the channel is muted for the current user or not.
-
hasPendingAttachments
final static Boolean hasPendingAttachments(Message $self)
Checks if the given Message has pending attachments. A pending attachment is an attachment that is either in Attachment.UploadState.InProgress or Attachment.UploadState.Idle.
-
-
-
-