import detector from "./detector.js";
import { cleanMessageContent } from "../utils/strings.js";

/*check if someone reply to a "quoi" with a "feur" or "quoifeur"
send praise
*/

const answers = [
  "Toi t'es un bon",
  "ça j'aime, ça",
  "bien joué !",
  "aller !",
  'https://tenor.com/fr/view/deez-ha-got-heem-got-em-got-him-gif-4824899',
  'https://tenor.com/fr/view/kaamelott-joueur-voil%C3%A0-faites-plaisir-gif-18227872',
  'https://tenor.com/view/kaamelott-yvain-exp%C3%A9ience-champion-cest-lexp%C3%A9rience-qui-parle-gif-17313437',
  'https://tenor.com/fr/view/caprio-oh-well-gif-25938306',
  'https://tenor.com/fr/view/pro-move-ted-lasso-nicely-done-compliment-jason-sudeikis-gif-17283104469342346529',
  'https://tenor.com/fr/view/well-played-sir-gif-22047381'
];

export default class FeurDetector extends detector {
  triggerName = 'feur';

  detect(message) {
    return /(?:^|\b)feur(?:\b|$)/i.test(cleanMessageContent(message));
  }

  createSpecificReply(message) {
    if (this.detect(message)) {
      return Promise.resolve(answers[Math.floor(Math.random() * answers.length)]);
    }
    return Promise.resolve(null);
  }
}