const { Events } = require('discord.js');

module.exports = {
  name: Events.MessageCreate,
  async execute({ log }, message) {

    if (message.channelId === process.env.MINECRAFT_CHANNEL_ID && !message.author.bot) {
      await fetch(process.env.WEB_HOST + '/api/minecraft/message/chattominecraft', {
        method: 'POST',
        body: JSON.stringify({
          content: message.content,
          discordId: message.author.id,
        }),
      });
    }
  },
};
