<commit_before>var format = require('util').format
var Promise = require('bluebird')
var request = require('request')
var post = Promise.promisify(request.post)

module.exports = {
  textForNewPost: function (post, community) {
    var relatedUser
    const creator = post.relations.user
    if (post.isWelcome()) {
      relatedUser = post.relations.relatedUsers.first()
      return format('<%s|%s> joined <%s|%s>',
        Frontend.Route.profile(relatedUser), relatedUser.get('name'),
        Frontend.Route.community(community), community.get('name'))
    } else {
      return format('<%s|%s> posted <%s|"%s"> in <%s|%s>',
        Frontend.Route.profile(creator), creator.get('name'),
        Frontend.Route.post(post), post.get('name'),
        Frontend.Route.community(community), community.get('name'))
    }
  },
  send: (message, uri) =>
    post({
      uri,<commit_msg>add env var check before sending messages to Slack<commit_after>var format = require('util').format
var Promise = require('bluebird')
var request = require('request')
var post = Promise.promisify(request.post)

module.exports = {
  textForNewPost: function (post, community) {
    var relatedUser
    const creator = post.relations.user
    if (post.isWelcome()) {
      relatedUser = post.relations.relatedUsers.first()
      return format('<%s|%s> joined <%s|%s>',
        Frontend.Route.profile(relatedUser), relatedUser.get('name'),
        Frontend.Route.community(community), community.get('name'))
    } else {
      return format('<%s|%s> posted <%s|"%s"> in <%s|%s>',
        Frontend.Route.profile(creator), creator.get('name'),
        Frontend.Route.post(post), post.get('name'),
        Frontend.Route.community(community), community.get('name'))
    }
  },
  send: (message, uri) =>
    !process.env.DISABLE_SLACK_INTEGRATION && post({
      uri,
{'fraction_non_alphanumeric': 0.16675719717544812, 'fraction_numerical': 0.0, 'mean_word_length': 3.7844155844155845, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5408950', 'n_tokens_mistral': 578, 'n_tokens_neox': 571, 'n_words': 112}