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

/*check if someone reply to a "quoi" with a "quoicoubeh" or "coubeh"
send roasts
*/
const answers = [
  'Motif de ban ça',
  "Non mais t'es pas bien toi ?",
  'https://tenor.com/view/kaamelott-leodagan-somme-sorte-provocateur-gif-18229391',
  'https://tenor.com/fr/view/movies-titanic-quotes-its-been-years-84years-gif-14851580',
  'https://tenor.com/fr/view/au-bucher-shouting-gif-15611785',
  'https://tenor.com/fr/view/kaamelott-r%C3%A9purgateur-h%C3%A9r%C3%A9tique-au-bucher-gif-18206884'
  
];

export default class QuoicoubehDetector extends Detector {
  triggerName = 'quoicoubeh';

  detect(message) {
    return /(?:^|\b)(quoi)?coubeh(?:\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);
  }
}