mentionUsers = async (str, session, post, when) => {
  let users = str.match(/[^|\s]?@[\d\w]+/g)

  if (users) {
    for (let h of users) {
      let hash = h.slice(1)
      if (hash.substr(0, 1) !== '@') {
        let [{ userCount }] = await db.query(
          'SELECT COUNT(id) AS userCount FROM users WHERE username=?',
          [hash]
        )
        let id = await getId(hash)

        if (userCount == 1 && id != session) {
          await db.query('INSERT INTO notifications SET ?', {
            notify_by: session,
            notify_to: id,
            post_id: post,
            type: when == 'post' ? 'mention_post' : 'mention_comment',
            notify_time: new Date().getTime(),
          })
        }
      }
    }
  }
}
Mention users
@param {String} str Text which will be used to get mentioned users
@param {Number} session sessionID
@param {Number} post PostID
@param {String} when For fn to have knowledge when users were mentioned