<commit_before>const Promise = require('bluebird');
const {Router} = require('express');
const {readFileSync, writeFileSync} = require('fs');
const {filter, indexOf, isEmpty, head, map, sortBy} = require('lodash');
const request = require('request-promise');

const who = 'who.tmp';
const when = 'when.tmp';
const token = process.env.SLACK_API_TOKEN;

const getListOfMembers = () => request({
    url: 'https://slack.com/api/users.list',
    qs: {token},
    json: true
}).then((res) => {
    const {members} = res;
    return Promise.resolve(sortBy(filter(map(members, 'real_name'), (m) => m !== 'slackbot')));
});<commit_msg>Fixed logic for retrieving list of users<commit_after>const Promise = require('bluebird');
const {Router} = require('express');
const {readFileSync, writeFileSync} = require('fs');
const {filter, indexOf, isEmpty, head, map, sortBy} = require('lodash');
const request = require('request-promise');

const who = 'who.tmp';
const when = 'when.tmp';
const token = process.env.SLACK_API_TOKEN;

const getListOfMembers = () => request({
    url: 'https://slack.com/api/users.list',
    qs: {token},
    json: true
}).then((res) => {
    const {members} = res;
    return Promise.resolve(sortBy(filter(map(members, (member)=>reverse(member.real_name.replace(' ', '~').split('~')).join(', ')), (m) => m !== 'slackbot')));
});
{'fraction_non_alphanumeric': 0.20074349442379183, 'fraction_numerical': 0.0, 'mean_word_length': 5.289719626168225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '1027443', 'n_tokens_mistral': 444, 'n_tokens_neox': 441, 'n_words': 105}