{"size": 1001, "ext": "js", "max_stars_repo_path": "src/events/Message.js", "max_stars_repo_name": "Tominous/wumpcraft", "max_stars_repo_stars_event_min_datetime": "2019-11-26T08:41:39.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-26T08:41:39.000Z", "max_issues_repo_path": "src/events/Message.js", "max_issues_repo_name": "resslerruntime/wumpcraft", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/events/Message.js", "max_forks_repo_name": "resslerruntime/wumpcraft", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.6, "max_line_length": 120, "alphanum_fraction": 0.6333666334}
class Message extends require('../types/Events') {
  constructor() {
    super();
  }

  init(client, msg) {
    if (!msg.guild) return;
    if (msg.author.bot) return;
    if (msg.content === this.prefix) return;
    if (!msg.content.toLowerCase().startsWith(this.prefix.toLowerCase())) return;

    const permissions = client.permissions(msg.guild.me);
    if (permissions.length) return msg.channel.send(`❌
 I can not perform this command due to missing permissions in this server:\n${permissions.join(', ')}`).catch(() => {});

    const command = msg.content.toLowerCase().split(' ')[0].slice(this.prefix.length);
    const args = msg.content.split(' ').slice(1);

    const { commands, aliases } = client;

    let cmd;
    if (commands.has(command)) {
      cmd = commands.get(command);
    } else if (aliases.has(command)) {
      cmd = commands.get(aliases.get(command));
    }

    if (cmd) new cmd.run().run(client, msg, args);
  }
}

module.exports = {
  run: Message,
  name: 'message'
};