From 7ee772a6b99b0b5b10e1b69faa9104d86001de4b Mon Sep 17 00:00:00 2001 From: Tutur33 Date: Mon, 26 Feb 2024 11:20:08 +0100 Subject: [PATCH] add game command --- commands/game/{2048.js => 2048.ts} | 9 +- commands/game/{8ball.js => 8ball.ts} | 8 +- commands/game/{catsay.js => catsay.ts} | 9 +- commands/game/{demineur.js => demineur.ts} | 10 +- commands/game/{fasttype.js => fasttype.ts} | 11 +-- commands/game/{findemoji.js => findemoji.ts} | 9 +- commands/game/{flood.js => flood.ts} | 9 +- ...{guessThePokemon.js => guessThePokemon.ts} | 10 +- commands/game/{morpion.js => morpion.ts} | 9 +- commands/game/{pendu.js => pendu.ts} | 7 +- commands/game/{pfc.js => pfc.ts} | 7 +- .../game/{puissance4.js => puissance4.ts} | 14 ++- commands/game/{slot.js => slot.ts} | 9 +- commands/game/{snake.js => snake.ts} | 10 +- commands/game/wordle.js | 78 --------------- commands/game/wordle.ts | 99 +++++++++++++++++++ commands/help.ts | 2 +- commands/ping.ts | 2 +- fonctions/loadCommands.ts | 7 +- fonctions/loadEvents.ts | 1 - fonctions/run.ts | 4 +- package-lock.json | 64 ++++++++++++ package.json | 1 + 23 files changed, 229 insertions(+), 160 deletions(-) rename commands/game/{2048.js => 2048.ts} (82%) rename commands/game/{8ball.js => 8ball.ts} (90%) rename commands/game/{catsay.js => catsay.ts} (80%) rename commands/game/{demineur.js => demineur.ts} (85%) rename commands/game/{fasttype.js => fasttype.ts} (92%) rename commands/game/{findemoji.js => findemoji.ts} (88%) rename commands/game/{flood.js => flood.ts} (84%) rename commands/game/{guessThePokemon.js => guessThePokemon.ts} (81%) rename commands/game/{morpion.js => morpion.ts} (90%) rename commands/game/{pendu.js => pendu.ts} (96%) rename commands/game/{pfc.js => pfc.ts} (93%) rename commands/game/{puissance4.js => puissance4.ts} (83%) rename commands/game/{slot.js => slot.ts} (76%) rename commands/game/{snake.js => snake.ts} (84%) delete mode 100644 commands/game/wordle.js create mode 100644 commands/game/wordle.ts diff --git a/commands/game/2048.js b/commands/game/2048.ts similarity index 82% rename from commands/game/2048.js rename to commands/game/2048.ts index 808a92c..6e9dd99 100644 --- a/commands/game/2048.js +++ b/commands/game/2048.ts @@ -1,13 +1,12 @@ +import { Message } from "discord.js"; const { TwoZeroFourEight } = require('discord-gamecord'); module.exports = { - name: '2048', description: 'Jouer au jeu 2048', emote: '🎲', - utilisation: '2048', - category: 'game', + utilisation: '', - async execute(message, args) { + async execute(message: Message) { const Game = new TwoZeroFourEight({ message: message, isSlashGame: false, @@ -24,7 +23,7 @@ module.exports = { Game.startGame(); - Game.on('gameOver', result => { + Game.on('gameOver', (result: any) => { }); }, }; \ No newline at end of file diff --git a/commands/game/8ball.js b/commands/game/8ball.ts similarity index 90% rename from commands/game/8ball.js rename to commands/game/8ball.ts index 5b300fb..24bc254 100644 --- a/commands/game/8ball.js +++ b/commands/game/8ball.ts @@ -1,12 +1,12 @@ +import { Message } from "discord.js"; + module.exports = { - name: '8ball', aliases: ['eightball', '8b'], description: 'Posez une question à la boule magique 8', emote: '🔮', - utilisation: '8ball ', - category: 'game', + utilisation: '', - execute(message, args) { + execute(message: Message, args: string[]) { if (!args[0]) { return message.reply("Veuillez poser une question."); } diff --git a/commands/game/catsay.js b/commands/game/catsay.ts similarity index 80% rename from commands/game/catsay.js rename to commands/game/catsay.ts index cc2fb8b..a8eaee4 100644 --- a/commands/game/catsay.js +++ b/commands/game/catsay.ts @@ -1,11 +1,12 @@ +import { Message } from "discord.js"; + module.exports = { - name: 'catsay', aliases: ['chatdire'], description: 'Faire parler les chat', emote: '🐱', - utilisation: 'catsay ', - category: 'game', - async execute( message, args) { + utilisation: '', + + async execute( message: Message, args: string[]) { message.delete() diff --git a/commands/game/demineur.js b/commands/game/demineur.ts similarity index 85% rename from commands/game/demineur.js rename to commands/game/demineur.ts index dc723de..a2de309 100644 --- a/commands/game/demineur.js +++ b/commands/game/demineur.ts @@ -1,12 +1,12 @@ +import { Message } from "discord.js"; const { Minesweeper } = require('discord-gamecord'); module.exports = { - name: 'demineur', description: 'Jouer à un jeu démineur', emote: '💣', - utilisation: 'demineur', - category: 'game', - async execute(message, args) { + utilisation: '', + + async execute(message: Message) { const Game = new Minesweeper({ message: message, isSlashGame: false, @@ -24,7 +24,7 @@ module.exports = { }); Game.startGame(); - Game.on('gameOver', result => { + Game.on('gameOver', (result: any) => { }); }, }; \ No newline at end of file diff --git a/commands/game/fasttype.js b/commands/game/fasttype.ts similarity index 92% rename from commands/game/fasttype.js rename to commands/game/fasttype.ts index 614cebc..61e07c3 100644 --- a/commands/game/fasttype.js +++ b/commands/game/fasttype.ts @@ -1,3 +1,4 @@ +import { Message } from "discord.js"; const { FastType } = require('discord-gamecord'); const sentences = [ 'Une phrase super cool à taper rapidement.', @@ -27,14 +28,12 @@ const sentences = [ ]; module.exports = { - name: 'fasttype', aliases: ['typefast'], description: 'Jouer à un jeu de vitesse de frappe', emote: '⌨️', - utilisation: 'fasttype', - category: 'game', + utilisation: '', - async execute(message, args) { + async execute(message: Message) { const randomSentence = sentences[Math.floor(Math.random() * sentences.length)]; const Game = new FastType({ @@ -51,9 +50,7 @@ module.exports = { loseMessage: 'Vous avez perdu ! Vous n\'avez pas tapé la phrase correctement à temps.', }); - Game.startGame(); - - Game.on('gameOver', result => { + Game.on('gameOver', (result: any) => { }); }, }; \ No newline at end of file diff --git a/commands/game/findemoji.js b/commands/game/findemoji.ts similarity index 88% rename from commands/game/findemoji.js rename to commands/game/findemoji.ts index b64afe5..9fca937 100644 --- a/commands/game/findemoji.js +++ b/commands/game/findemoji.ts @@ -1,14 +1,13 @@ const { FindEmoji } = require('discord-gamecord'); +import { Message } from "discord.js"; module.exports = { - name: 'findemoji', aliases: ['trouveremoji'], description: 'Jouer au jeu Trouver Emoji', emote: '🔍', - utilisation: 'findemoji', - category: 'game', + utilisation: '', - async execute(message, args) { + async execute(message: Message) { const Game = new FindEmoji({ message: message, isSlashGame: false, @@ -30,7 +29,7 @@ module.exports = { Game.startGame(); - Game.on('gameOver', result => { + Game.on('gameOver', (result: any) => { }); }, }; \ No newline at end of file diff --git a/commands/game/flood.js b/commands/game/flood.ts similarity index 84% rename from commands/game/flood.js rename to commands/game/flood.ts index 14ab053..714fc1c 100644 --- a/commands/game/flood.js +++ b/commands/game/flood.ts @@ -1,14 +1,13 @@ const { Flood } = require('discord-gamecord'); +import { Message } from "discord.js"; module.exports = { - name: 'flood', aliases: ['inondation'], description: 'Jouer au jeu Flood', emote: '🌊', - utilisation: 'flood', - category: 'game', + utilisation: '', - async execute(message, args) { + async execute(message: Message) { const Game = new Flood({ message: message, isSlashGame: false, @@ -28,7 +27,7 @@ module.exports = { Game.startGame(); - Game.on('gameOver', result => { + Game.on('gameOver', (result: any) => { }); }, }; \ No newline at end of file diff --git a/commands/game/guessThePokemon.js b/commands/game/guessThePokemon.ts similarity index 81% rename from commands/game/guessThePokemon.js rename to commands/game/guessThePokemon.ts index 97d962e..46684da 100644 --- a/commands/game/guessThePokemon.js +++ b/commands/game/guessThePokemon.ts @@ -1,14 +1,13 @@ const { GuessThePokemon } = require('discord-gamecord'); +import { Message } from "discord.js"; module.exports = { - name: 'guesspokemon', aliases: ['guesspok', 'guesspoke', 'gp', 'devinepokemon', 'devinepok', 'devinepoke'], description: 'Jouer au jeu trouver le pokemon', emote: '🐼', - utilisation: 'guesspokemon', - category: 'game', + utilisation: '', - async execute(message, args) { + async execute(message: Message) { const Game = new GuessThePokemon({ message: message, isSlashGame: false, @@ -24,8 +23,7 @@ module.exports = { }); Game.startGame(); - Game.on('gameOver', result => { - console.log(result); // => { result... } + Game.on('gameOver', (result: any) => { }); }, }; \ No newline at end of file diff --git a/commands/game/morpion.js b/commands/game/morpion.ts similarity index 90% rename from commands/game/morpion.js rename to commands/game/morpion.ts index 7b12091..50e5a0d 100644 --- a/commands/game/morpion.js +++ b/commands/game/morpion.ts @@ -1,15 +1,14 @@ const { TicTacToe } = require('discord-gamecord'); +import { Message } from "discord.js"; module.exports = { - name: 'morpion', aliases: ['morp'], description: 'Jouer à morpion', emote: '⭕', - utilisation: 'morpion', - category: 'game', + utilisation: '', - async execute(message, args) { - if (!message.mentions.members.first()) + async execute(message: Message) { + if (!message.mentions.members?.first()) return message.reply("Veuillez mentionner un adversaire"); const Game = new TicTacToe({ diff --git a/commands/game/pendu.js b/commands/game/pendu.ts similarity index 96% rename from commands/game/pendu.js rename to commands/game/pendu.ts index ea8ba31..8874d5d 100644 --- a/commands/game/pendu.js +++ b/commands/game/pendu.ts @@ -1,4 +1,5 @@ const { Hangman } = require('discord-gamecord'); +import { Message } from "discord.js"; const words = [ 'pomme', 'banane', 'cerise', 'poire', 'figue', 'raisin', @@ -28,13 +29,11 @@ const words = [ ]; module.exports = { - name: 'pendu', description: 'Jouer à pendu', emote: '🎩', - utilisation: 'pendu', - category: 'game', + utilisation: '', - async execute(message, args) { + async execute(message: Message) { const game = new Hangman({ message: message, isSlashGame: false, diff --git a/commands/game/pfc.js b/commands/game/pfc.ts similarity index 93% rename from commands/game/pfc.js rename to commands/game/pfc.ts index c6ae38c..fe24fec 100644 --- a/commands/game/pfc.js +++ b/commands/game/pfc.ts @@ -1,14 +1,13 @@ +import { Message } from "discord.js"; const choices = ["pierre", "papier", "ciseaux"]; module.exports = { - name: 'pfc', aliases: ['pierre-papier-ciseaux', 'shifumi', 'pierrepapierciseaux', 'rockpaperscissors', 'rock-paper-scissors'], description: 'Jouer à pierre-papier-ciseaux', emote: '✊', - utilisation: 'pfc', - category: 'game', + utilisation: '', - async execute(message, args) { + async execute(message: Message, args: string[]) { const userChoice = args[0]; const botChoice = choices[Math.floor(Math.random() * choices.length)]; diff --git a/commands/game/puissance4.js b/commands/game/puissance4.ts similarity index 83% rename from commands/game/puissance4.js rename to commands/game/puissance4.ts index 17cf4b1..d106301 100644 --- a/commands/game/puissance4.js +++ b/commands/game/puissance4.ts @@ -1,19 +1,17 @@ const { Connect4 } = require('discord-gamecord') -const color = '#0099ff'; +import { Message } from "discord.js"; +const color = '#0099ff'; + module.exports = { - name: 'puissance4', - utilisation: 'puissance4', + utilisation: '', description: 'Lancer une partie de puissance4', emote: '🔴', - category: 'game', - async execute(message) { + async execute(message: Message) { - if (!message.mentions || !message.mentions.members.first()) + if (!message.mentions || !message.mentions.members?.first()) return message.reply("Veuillez mentionner un membre") - - new Connect4({ message: message, opponent: message.mentions.users.first(), diff --git a/commands/game/slot.js b/commands/game/slot.ts similarity index 76% rename from commands/game/slot.js rename to commands/game/slot.ts index b57024b..c19a2d2 100644 --- a/commands/game/slot.js +++ b/commands/game/slot.ts @@ -1,14 +1,13 @@ const { Slots } = require('discord-gamecord'); +import { Message } from "discord.js"; module.exports = { - name: 'slot', aliases: ['slotmachine'], description: 'Jouer au jeu Slot', emote: '🎰', - utilisation: 'slot', - category: 'game', + utilisation: '', - async execute(message, args) { + async execute(message: Message) { const Game = new Slots({ message: message, isSlashGame: false, @@ -20,7 +19,7 @@ module.exports = { }); Game.startGame(); - Game.on('gameOver', result => { + Game.on('gameOver', (result: any) => { }); }, }; \ No newline at end of file diff --git a/commands/game/snake.js b/commands/game/snake.ts similarity index 84% rename from commands/game/snake.js rename to commands/game/snake.ts index eca18f3..4571ee6 100644 --- a/commands/game/snake.js +++ b/commands/game/snake.ts @@ -1,14 +1,14 @@ const { Snake } = require("discord-gamecord") -const color = '#0099ff'; // Définit +import { Message } from "discord.js"; +const color = '#0099ff'; + module.exports = { - name: 'snake', aliases: ['serpent', 'snakegame'], - utilisation: 'snake', description: 'Lancer une partie de snake', emote: '🐍', - category: 'game', + utilisation: '', - async execute(message, args) { + async execute(message: Message) { new Snake({ message: message, diff --git a/commands/game/wordle.js b/commands/game/wordle.js deleted file mode 100644 index cec4ec4..0000000 --- a/commands/game/wordle.js +++ /dev/null @@ -1,78 +0,0 @@ -const { Wordle } = require('discord-gamecord'); - -const words = [ - 'pomme', 'banane', 'cerise', 'poire', 'figue', 'raisin', - 'orange', 'em', 'fraise', 'abricot', 'prune', 'coing', - 'kiwi', 'ananas', 'tomate', 'carotte', 'oignon', 'concombre', - 'champignon', 'haricot', 'mais', 'navet', 'patate', 'radis', - 'salade', 'artichaut', 'betterave', 'brocoli', 'courgette', - 'epinards', 'fenouil', 'laitue', 'mache', 'poivron', 'raifort', - 'roquette', 'topinambour', 'vinaigrette', 'zucchini', - 'pere', 'mere', 'frere', 'soeur', 'fils', 'fille', 'bebe', - 'enfant', 'grand-pere', 'grand-mere', 'cousin', 'cousine', - 'oncle', 'tante', 'amitie', 'amour', 'famille', 'courage', - 'joie', 'sagesse', 'travail', 'triomphe', 'victoire', 'reussite', - 'bonjour', 'au revoir', 'merci', 'excusez-moi', - 'oui', 'non', 'ou', 'quoi', 'qui', 'combien', 'pourquoi', - 'comment', 'quand', 'ou', 'que', 'en', 'de', 'du', - 'sur', 'chez', 'sous', 'devant', 'derriere', 'hors', 'parmi', - 'selon', 'malgre', 'grâce à', 'avant', 'apres', 'alors que', - 'bien que', 'si', 'alors', 'donc', 'sinon', 'mais', 'et', - 'ou', 'non', 'plus', 'moins', 'tout', 'pas', 'beaucoup', - 'peu', 'assez', 'trop', 'pas assez', 'tres', 'vraiment', - 'toujours', 'jamais', 'rarement', 'souvent', 'maintenant', - 'ensuite', 'hier', 'demain', 'matin', 'monde', 'plage', 'compte', 'site', 'salle', 'bain', 'maris','cheveu', 'bras', - 'cuillere', 'assiette', 'vin', 'fruit', 'pantalon', 'pull', 'robe', 'chaussure', 'epouse', 'année', 'femme', - 'feu', 'balance', 'batterie', 'caleçon', 'collant', 'contenance', 'gencive', 'jean', 'jogging', - 'pince', 'pantalon', 'pince', 'pyjama', 'short', 'slip', 'soup', 'vaisselle', - 'amie', 'amour', 'ami', 'bleu', 'brun', 'blanc', 'chat', 'chat', 'chien', 'chats', 'cheveu', 'clair', 'clerc', 'creer', 'crêpe', 'cycle', - 'dame', 'date', 'day', 'dix', 'doigt', 'drôle', 'droit', 'eau', 'école', 'égal', 'éléphant', 'épée', 'épicier', 'étude', 'facile', 'fête', 'fleur', - 'flûte', 'fois', 'force', 'franc', 'frein', 'frir', 'froid', 'front', 'fruit', 'fuir', 'fumée', 'fumer', 'glace', 'grain', 'grade', 'grand', 'gras', - 'gros', 'guère', 'heure', 'hippopotamus', 'homme', 'homme', 'horloge', 'hôpital', 'humide', 'huître', 'huit', 'hymne', 'iceberg', 'idéel', 'il', - 'île', 'imaginer', 'immobile', 'impliquer', 'important', 'incrémenter', 'index', 'infini', 'insecte', 'intérêt', 'inviter', 'irriter', 'juste', - 'kilo', 'kilogramme', 'kilt', 'kiwi', 'koala', 'labyrinthe', 'lac', 'lacune', 'lacs', 'lâcher', 'labeur', 'lance', 'lancer', 'larmes', 'larme', - 'large', 'lasagne', 'lasso', 'latence', 'latin', 'latitude', 'laurier', 'lavage', 'lave', 'laxatif', 'lazaret', 'lazer', 'léger', 'légume', - 'lemon', 'lendemain', 'lente', 'lentement', 'lettres', 'lettre', 'lexique', 'lieu', 'ligne', 'lingot', 'liquide', 'lit', 'littoral', 'livre', - 'livrer', 'local', 'locale', 'locaux', 'lodge', 'londres', 'long', 'longtemps', 'lot', 'lotion', 'louer', 'lourd', 'lourde', 'lourdes', 'lourds', - 'loyauté', 'lucas', 'lucide', 'lueur', 'lugubre', 'lundi', 'lutin', 'lutte', 'lyre', 'macaron', 'madame', 'mademoiselle', 'mademoiselle', 'magasin', - 'magique', 'maigre', 'maillon', 'maison', 'maîtresse', 'maître', 'majesté', 'majorité', 'maladif', 'maladive', 'malgré', 'malice', 'malin', - 'mallette', 'manche', 'maniable', 'manuel', 'manière', 'manoeuvre', 'manquer', 'manteau', 'marché', 'marcher', 'mariage', 'maritime', 'marthe', - 'mascotte', 'massif', 'matière', 'matin', 'matrice', 'matériel', 'maudire', 'mauvais', 'mauvaise', 'mauvaises', 'méchant', 'méchante', 'méchantes', - 'méchants', 'mécontent', 'médecin', 'méditer', 'mélanger', 'membre', 'membres', 'mensonge', 'ménager', 'mener', 'menhir', 'mensonge', 'mentionner', - 'menu', 'mercredi', 'mercredi', 'mesure', 'mettre', 'micro', 'miel', 'milieu', 'millieu', 'million', 'mince', 'mine', 'ministre', 'minute', - 'minuscule', 'minuscule', 'minute', 'minutes', 'minuterie', 'miracle', 'mir', 'mixer', 'mobile', 'mode', 'modèle', 'modifier', 'mois', 'moment', - 'monde', 'montagne', 'montant', 'morceau', 'mort', 'mot', 'motif', 'moteur', 'mouche', 'moulin', 'moulu', 'much', -, 'music', 'musique', 'musique', 'myriade', 'myself', 'naïf', 'naïve', 'naïves', 'naïfs', 'nature', 'navire', 'navré', 'naviguer', - 'neige', 'neuf', 'neutre', 'newton', 'ni', 'noble', 'nocif', 'nocturne', 'nom', 'nombre', 'nombreuses', -, 'notable', 'note', 'notes', 'noter', 'nouveau', 'nuage', 'numéro', 'objet', 'obscur', 'obstacle', 'occasion', 'octobre', - -]; -const shortWords = words.filter(word => word.length === 5); -module.exports = { - name: 'wordle', - description: 'Jouer à Wordle', - emote: '🔡', - utilisation: 'wordle', - category: 'game', - - async execute(message, args) { - const Game = new Wordle({ - message: message, - isSlashGame: false, - embed: { - title: 'Wordle', - color: '#5865F2', - }, - customWord: shortWords[Math.floor(Math.random() * shortWords.length)], - timeoutTime: 60000, - winMessage: 'Tu as gagné! Le mot était **{word}**.', - loseMessage: 'Tu as perdu! Le mot était **{word}**.', - playerOnlyMessage: 'Seul {player} peut utiliser ces boutons.' - }); - - Game.startGame(); - Game.on('gameOver', result => { - console.log(result); // => { result... } - }); - }, -}; \ No newline at end of file diff --git a/commands/game/wordle.ts b/commands/game/wordle.ts new file mode 100644 index 0000000..7dc7ea1 --- /dev/null +++ b/commands/game/wordle.ts @@ -0,0 +1,99 @@ +const { Wordle } = require('discord-gamecord'); +import { Message } from "discord.js"; + +const words = [ + 'pomme', 'banane', 'cerise', 'poire', 'figue', 'raisin', + 'orange', 'em', 'fraise', 'abricot', 'prune', 'coing', + 'kiwi', 'ananas', 'tomate', 'carotte', 'oignon', 'concombre', + 'champignon', 'haricot', 'mais', 'navet', 'patate', 'radis', + 'salade', 'artichaut', 'betterave', 'brocoli', 'courgette', + 'epinards', 'fenouil', 'laitue', 'mache', 'poivron', 'raifort', + 'roquette', 'topinambour', 'vinaigrette', 'zucchini', + 'pere', 'mere', 'frere', 'soeur', 'fils', 'fille', 'bebe', + 'enfant', 'grand-pere', 'grand-mere', 'cousin', 'cousine', + 'oncle', 'tante', 'amitie', 'amour', 'famille', 'courage', + 'joie', 'sagesse', 'travail', 'triomphe', 'victoire', 'reussite', + 'bonjour', 'au revoir', 'merci', 'excusez-moi', + 'oui', 'non', 'ou', 'quoi', 'qui', 'combien', 'pourquoi', + 'comment', 'quand', 'ou', 'que', 'en', 'de', 'du', + 'sur', 'chez', 'sous', 'devant', 'derriere', 'hors', 'parmi', + 'selon', 'malgre', 'grâce à', 'avant', 'apres', 'alors que', + 'bien que', 'si', 'alors', 'donc', 'sinon', 'mais', 'et', + 'ou', 'non', 'plus', 'moins', 'tout', 'pas', 'beaucoup', + 'peu', 'assez', 'trop', 'pas assez', 'tres', 'vraiment', + 'toujours', 'jamais', 'rarement', 'souvent', 'maintenant', + 'ensuite', 'hier', 'demain', 'matin', 'monde', 'plage', + 'compte', 'site', 'salle', 'bain', 'maris','cheveu', 'bras', + 'cuillere', 'assiette', 'vin', 'fruit', 'pantalon', 'pull', + 'robe', 'chaussure', 'epouse', 'année', 'femme','feu', 'balance', + 'batterie', 'caleçon', 'collant', 'contenance', 'gencive', 'jean', + 'jogging', 'pince', 'pantalon', 'pince', 'pyjama', 'short', 'slip', + 'soup', 'vaisselle', 'amie', 'amour', 'ami', 'bleu', 'brun', + 'blanc', 'chat', 'chat', 'chien', 'chats', 'cheveu', 'clair', + 'clerc', 'creer', 'crêpe', 'cycle', 'dame', 'date', 'day', 'dix', + 'doigt', 'drôle', 'droit', 'eau', 'école', 'égal', 'éléphant', + 'épée', 'épicier', 'étude', 'facile', 'fête', 'fleur', 'flûte', + 'fois', 'force', 'franc', 'frein', 'frir', 'froid', 'front', + 'fruit', 'fuir', 'fumée', 'fumer', 'glace', 'grain', 'grade', + 'grand', 'gras', 'gros', 'guère', 'heure', 'hippopotamus', + 'homme', 'homme', 'horloge', 'hôpital', 'humide', 'huître', + 'huit', 'hymne', 'iceberg', 'idéel', 'il', 'île', 'imaginer', + 'immobile', 'impliquer', 'important', 'incrémenter', 'index', + 'infini', 'insecte', 'intérêt', 'inviter', 'irriter', 'juste', + 'kilo', 'kilogramme', 'kilt', 'kiwi', 'koala', 'labyrinthe', + 'lac', 'lacune', 'lacs', 'lâcher', 'labeur', 'lance', 'lancer', + 'larmes', 'larme', 'large', 'lasagne', 'lasso', 'latence', 'latin', + 'latitude', 'laurier', 'lavage', 'lave', 'laxatif', 'lazaret', + 'lazer', 'léger', 'légume', 'lemon', 'lendemain', 'lente', 'lentement', + 'lettres', 'lettre', 'lexique', 'lieu', 'ligne', 'lingot', 'liquide', + 'lit', 'littoral', 'livre', 'livrer', 'local', 'locale', 'locaux', + 'lodge', 'londres', 'long', 'longtemps', 'lot', 'lotion', 'louer', + 'lourd', 'lourde', 'lourdes', 'lourds', 'loyauté', 'lucas', 'lucide', + 'lueur', 'lugubre', 'lundi', 'lutin', 'lutte', 'lyre', 'macaron', + 'madame', 'mademoiselle', 'mademoiselle', 'magasin', 'magique', + 'maigre', 'maillon', 'maison', 'maîtresse', 'maître', 'majesté', + 'majorité', 'maladif', 'maladive', 'malgré', 'malice', 'malin', + 'mallette', 'manche', 'maniable', 'manuel', 'manière', 'manoeuvre', + 'manquer', 'manteau', 'marché', 'marcher', 'mariage', 'maritime', 'marthe', + 'mascotte', 'massif', 'matière', 'matin', 'matrice', 'matériel', + 'maudire', 'mauvais', 'mauvaise', 'mauvaises', 'méchant', 'méchante', + 'méchantes', 'méchants', 'mécontent', 'médecin', 'méditer', 'mélanger', + 'membre', 'membres', 'mensonge', 'ménager', 'mener', 'menhir', 'mensonge', + 'mentionner', 'menu', 'mercredi', 'mercredi', 'mesure', 'mettre', 'micro', + 'miel', 'milieu', 'millieu', 'million', 'mince', 'mine', 'ministre', 'minute', + 'minuscule', 'minuscule', 'minute', 'minutes', 'minuterie', 'miracle', 'mir', + 'mixer', 'mobile', 'mode', 'modèle', 'modifier', 'mois', 'moment', 'monde', + 'montagne', 'montant', 'morceau', 'mort', 'mot', 'motif', 'moteur', 'mouche', + 'moulin', 'moulu', 'much', 'music', 'musique', 'musique', 'myriade', 'myself', + 'naïf', 'naïve', 'naïves', 'naïfs', 'nature', 'navire', 'navré', 'naviguer', + 'neige', 'neuf', 'neutre', 'newton', 'ni', 'noble', 'nocif', 'nocturne', 'nom', + 'nombre', 'nombreuses', 'notable', 'note', 'notes', 'noter', 'nouveau', 'nuage', + 'numéro', 'objet', 'obscur', 'obstacle', 'occasion', 'octobre', +]; +const shortWords = words.filter(word => word.length === 5); + +module.exports = { + description: 'Jouer à Wordle', + emote: '🔡', + utilisation: '', + + async execute(message: Message) { + const Game = new Wordle({ + message: message, + isSlashGame: false, + embed: { + title: 'Wordle', + color: '#5865F2', + }, + customWord: shortWords[Math.floor(Math.random() * shortWords.length)], + timeoutTime: 60000, + winMessage: 'Tu as gagné! Le mot était **{word}**.', + loseMessage: 'Tu as perdu! Le mot était **{word}**.', + playerOnlyMessage: 'Seul {player} peut utiliser ces boutons.' + }); + + Game.startGame(); + Game.on('gameOver', (result: any) => { + }); + }, +}; \ No newline at end of file diff --git a/commands/help.ts b/commands/help.ts index 5eb2dcc..55c2cee 100644 --- a/commands/help.ts +++ b/commands/help.ts @@ -53,7 +53,7 @@ module.exports = { let categories: { [key: string]: Command[] } = {}; commands.forEach((command: any) => { if (!categories[command.category]) { - categories[command.category] = [{ name: command.name, description: command.description, emote: command.emote, utilisation: command.utilisation}]; + categories[command.category] = []; } categories[command.category]?.push(command); }); diff --git a/commands/ping.ts b/commands/ping.ts index f358cd2..9a6ac7e 100644 --- a/commands/ping.ts +++ b/commands/ping.ts @@ -7,7 +7,7 @@ module.exports = { utilisation: '', permission: 0, - async execute(message: any, args: any, client: any) { + async execute(message: any, args: string[], client: any) { const ping = new ButtonBuilder() .setCustomId('confirm') .setLabel('🔄') diff --git a/fonctions/loadCommands.ts b/fonctions/loadCommands.ts index 15ea3ca..129eef3 100644 --- a/fonctions/loadCommands.ts +++ b/fonctions/loadCommands.ts @@ -1,25 +1,22 @@ import fs from 'fs'; import path from 'path'; -module.exports = function loadEvents(client: any, dir: string) { +module.exports = function loadCommands(client: any, dir: string) { let count = 0; - dir = `../${dir}` fs.readdirSync(path.join(__dirname, dir)).forEach((file: string) => { const filePath = path.join(__dirname, dir, file); if (fs.statSync(filePath).isDirectory()) { - count += loadCommands(path.join(dir, file)); + count += loadCommands(client, path.join(dir, file)); } else if (file.endsWith('.js') || file.endsWith('.ts')) { try { delete require.cache[require.resolve(filePath)]; const command = require(filePath); const fileName = file.replace(/\.js|\.ts/g, ''); command.name = fileName; - console.log(command); if (!command.category) { const parentDir = path.basename(path.dirname(filePath)); command.category = parentDir === 'commands' ? 'other' : parentDir; } - console.log(command); client.commands.set(fileName, command); if (command.aliases) { command.aliases.forEach((alias: string) => { diff --git a/fonctions/loadEvents.ts b/fonctions/loadEvents.ts index c9bd61a..09ff212 100644 --- a/fonctions/loadEvents.ts +++ b/fonctions/loadEvents.ts @@ -4,7 +4,6 @@ import path from 'path'; module.exports = function loadEvents(client: Client, dir: string): number { let count = 0; - dir = `../${dir}` fs.readdirSync(path.join(__dirname, dir)).forEach((file: string) => { const filePath = path.join(__dirname, dir, file); if (fs.statSync(filePath).isDirectory()) { diff --git a/fonctions/run.ts b/fonctions/run.ts index 8e02107..fce93cb 100644 --- a/fonctions/run.ts +++ b/fonctions/run.ts @@ -8,8 +8,8 @@ module.exports = function run(token: string) { client.events = new Collection(); client.commands = new Collection(); - console.log(`${loadEvents(client, 'events')} events loaded`); - console.log(`${loadCommands(client, 'commands')} commands loaded`); + console.log(`${loadEvents(client, '..\\events')} events loaded`); + console.log(`${loadCommands(client, '..\\commands')} commands loaded`); client.login(token); }; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ddb1de0..98a6b4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "Apache-2.0", "dependencies": { + "discord-gamecord": "^4.4.1", "discord.js": "^14.14.1", "dotenv": "^16.4.5", "sqlite3": "^5.1.7" @@ -486,6 +487,16 @@ "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.61.tgz", "integrity": "sha512-o/dXNFfhBpYHpQFdT6FWzeO7pKc838QeeZ9d91CfVAtpr5XLK4B/zYxQbYgPdoMiTDvJfzcsLW5naXgmHGDNXw==" }, + "node_modules/discord-gamecord": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/discord-gamecord/-/discord-gamecord-4.4.1.tgz", + "integrity": "sha512-0IDI2C7QttWSPJStQNUZn89xFlgqo+qrJUC+/Bu8xPfnZ0G0AsBN6Ut0lwYcJOZkHnX5cNbwHl6Wj//5ws9oTA==", + "dependencies": { + "discord.js": "^14.8.0", + "html-entities": "^2.3.3", + "node-fetch": "^2.6.7" + } + }, "node_modules/discord.js": { "version": "14.14.1", "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.14.1.tgz", @@ -655,6 +666,21 @@ "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", "optional": true }, + "node_modules/html-entities": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.4.0.tgz", + "integrity": "sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mdevils" + }, + { + "type": "patreon", + "url": "https://patreon.com/mdevils" + } + ] + }, "node_modules/http-cache-semantics": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", @@ -1039,6 +1065,25 @@ "node": "^16 || ^18 || >= 20" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-gyp": { "version": "8.4.1", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz", @@ -1499,6 +1544,11 @@ "node": ">=8" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/ts-mixer": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz", @@ -1559,6 +1609,20 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 9af0ee4..82def12 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ }, "homepage": "https://github.com/Tutur33/gestion-perso#readme", "dependencies": { + "discord-gamecord": "^4.4.1", "discord.js": "^14.14.1", "dotenv": "^16.4.5", "sqlite3": "^5.1.7"