code: public void doSendText(@NotNull Peer peer, @NotNull String text,
                             @Nullable ArrayList<Integer> mentions, /*Ignored*/ @Nullable String markDownText,
                             boolean autoDetect) {
  
          text = text.trim();
  
          long rid = RandomUtils.nextRid();
          long date = createPendingDate();
          long sortDate = date + 365 * 24 * 60 * 60 * 1000L;
  
          if (autoDetect) {
              mentions = new ArrayList<>();
              if (peer.getPeerType() == PeerType.GROUP) {
                  Group group = getGroup(peer.getPeerId());
                  String lowText = text.toLowerCase();
                  if (group.getMembers() != null) {
                      for (GroupMember member : group.getMembers()) {
                          User user = getUser(member.getUid());
                          if (user.getNick() != null) {
                              String nick = "@" + user.getNick().toLowerCase();
                              // TODO: Better filtering
                              if (lowText.contains(nick + ":")
                                      || lowText.contains(nick + " ")
                                      || lowText.contains(" " + nick)
                                      || lowText.endsWith(nick)
                                      || lowText.equals(nick)) {
                                  mentions.add(user.getUid());
                              }
                          }
                      }
                  }
              }
          }
  
          TextContent content = TextContent.create(text, null, mentions);
  
          Message message = new Message(rid, sortDate, date, myUid(), MessageState.PENDING, content);
  
          context().getMessagesModule().getRouter().onOutgoingMessage(peer, message);
  
          pendingMessages.getPendingMessages().add(new PendingMessage(peer, rid, content));
          savePending();
  
          performSendContent(peer, rid, content);
      }
docs: Sending text