So I'm working on a bot for Slack that mentions a random user every week. I get to a point where the bot does exactly that, but I'm not sure how to avoid duplicates. As you can see in the screenshot below, duplicate names are being shown:

[![duplicate names](https://i.stack.imgur.com/hxijj.png)](https://i.stack.imgur.com/hxijj.png)

Here is my code:

```
// Handle events related to the websocket connection to Slack
controller.on('rtm_open', function (bot) {
  console.log('** The RTM api just connected!');

  // Get all users
  bot.api.users.list({}, function(err, list){

    // If list and members exist
    if (list && list.members) {

      list.members = list.members.filter(function(member) {
        return (member.real_name != undefined && member.real_name != "" && member.real_name != null && member.real_name != "slackbot");
      });

      // console.log(list.members);
      var previousRandomNumber = -1;

      // Every X amount of milliseconds
      var interval = setInterval(function() {
        var members = list.members;

        // Generating random number from 0 to how many members exist (exclusive) in the member list
        var randomNumber = Math.floor(Math.random() * members.length);

        console.log('1) previous: ' + previousRandomNumber + '  randomNumber ' + randomNumber);
        if (previousRandomNumber == randomNumber) {
          randomNumber = Math.floor(Math.random() * members.length);
        }
        console.log('2) previous: ' + previousRandomNumber + '  randomNumber ' + randomNumber);

        previousRandomNumber = randomNumber;

        // Get random name
        var randomName = members[randomNumber].name;

        //console.log(randomName);

        // If random name is null or undefined, reshuffle.
        if (randomName == null || randomName == "" || randomName == undefined) {
          console.log('user has been deleted');

          // clearInterval(interval);

        } else {
          console.log('actual person - ' + randomName);
          // Configuring webhook and sending message to channel
          bot.configureIncomingWebhook({url: 'https://hooks.slack.com/services/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'});
          bot.sendWebhook({
            text: '@' + randomName + ", you've been selected for #snapshot! ",
            channel: '#test',
          },function(err,res) {
            // handle error
          });
        }
      }, 3000); // 604800000 ms = 1 week
      console.log("message");
    }
  })
});

```

[Link to repo on GitHub](https://github.com/obliviga/snapshot-bot/blob/master/index.js)

Does anyone know how I could somehow splice the names that have already been mentioned from the array?