const Discord = require('discord.js');
const client = new Discord.Client();

// https://discordapp.com/oauth2/authorize?&client_id=368144406181838861&scope=bot&permissions=3072

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setPresence({
    game: {
      name: 'WoWAnalyzer.com',
      type: 0,
    },
  });
});

client.on('message', msg => {
  const content = msg.content;
  // TODO: create a group for the # part of the WCL URL
  const match = content.trim().match(/^(.*reports\/)?([a-zA-Z0-9]{16})\/?(#.*)?(.*)?$/);
  if (match && match[2]) {
    // TODO: filter for fight=XX and source=XX for #444
    msg.channel.send(`https://wowanalyzer.com/report/${match[2]}`);
  }
});

client.login(process.env.DISCORD_TOKEN);

@@ -270,124 +270,107 @@
 .set
-Presence(%7B%0A    game: %7B%0A      name: 'WoWAnalyzer.com',%0A      type: 0,%0A    %7D,%0A  %7D);%0A%7D);%0A%0Aclient.on('message', msg =%3E %7B
+Game('WoWAnalyzer.com');%0A%7D);%0A%0Aclient.on('message', msg =%3E %7B%0A  if (msg.author.bot) %7B%0A    return;%0A  %7D
 %0A  c

Update DiscordBot: Shorter game setting & don't respond to bots