This commit is contained in:
loicbersier 2019-01-01 10:50:32 +01:00
parent 72ad8244c4
commit 5859a58b2b
2 changed files with 12 additions and 14 deletions

View file

@ -23,13 +23,11 @@ class SayCommand extends Command {
async exec(message, args) { async exec(message, args) {
let text = args.text; let text = args.text;
if (!text) return;
// Load all the different files // Load all the different files
const verb = require('../../dictionary/verbs.json') const verb = require('../../dictionary/verbs.json')
const noun = require('../../dictionary/noun.json') const noun = require('../../dictionary/noun.json')
const adverbs = require('../../dictionary/adjectives.json') const adjective = require('../../dictionary/adjectives.json')
const adjective = require('../../dictionary/adverbs.json') const adverbs = require('../../dictionary/adverbs.json')
const activities = require('../../dictionary/activities.json') const activities = require('../../dictionary/activities.json')
const celebreties = require('../../dictionary/celebreties.json') const celebreties = require('../../dictionary/celebreties.json')
const countries = require('../../dictionary/countries.json') const countries = require('../../dictionary/countries.json')
@ -53,12 +51,12 @@ class SayCommand extends Command {
// Replace with a random word from the json // Replace with a random word from the json
do { do {
text = text.replace(/\[verb\]/, verb[randNumber(verb)]) text = text.replace(/\[verb\]/, verb[randNumber(verb)])
text = text.replace(/\[adverbs\]/, adverbs[randNumber(adverbs)]) text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)])
text = text.replace(/\[noun\]/, noun[randNumber(noun)]) text = text.replace(/\[noun\]/, noun[randNumber(noun)])
text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]) text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)])
text = text.replace(/\[activities\]/, activities[randNumber(activities)]) text = text.replace(/\[activity\]/, activities[randNumber(activities)])
text = text.replace(/\[celebrities\]/, celebreties[randNumber(celebreties)]) text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)])
text = text.replace(/\[countries\]/, countries[randNumber(countries)]) text = text.replace(/\[country\]/, countries[randNumber(countries)])
text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]) text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)])
text = text.replace(/\[elements\]/, elements[randNumber(elements)]) text = text.replace(/\[elements\]/, elements[randNumber(elements)])
text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]) text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)])

View file

@ -27,8 +27,8 @@ class SayCommand extends Command {
// Load all the different files // Load all the different files
const verb = require('../../dictionary/verbs.json') const verb = require('../../dictionary/verbs.json')
const noun = require('../../dictionary/noun.json') const noun = require('../../dictionary/noun.json')
const adverbs = require('../../dictionary/adjectives.json') const adjective = require('../../dictionary/adjectives.json')
const adjective = require('../../dictionary/adverbs.json') const adverbs = require('../../dictionary/adverbs.json')
const activities = require('../../dictionary/activities.json') const activities = require('../../dictionary/activities.json')
const celebreties = require('../../dictionary/celebreties.json') const celebreties = require('../../dictionary/celebreties.json')
const countries = require('../../dictionary/countries.json') const countries = require('../../dictionary/countries.json')
@ -52,12 +52,12 @@ class SayCommand extends Command {
// Replace with a random word from the json // Replace with a random word from the json
do { do {
text = text.replace(/\[verb\]/, verb[randNumber(verb)]) text = text.replace(/\[verb\]/, verb[randNumber(verb)])
text = text.replace(/\[adverbs\]/, adverbs[randNumber(adverbs)]) text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)])
text = text.replace(/\[noun\]/, noun[randNumber(noun)]) text = text.replace(/\[noun\]/, noun[randNumber(noun)])
text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]) text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)])
text = text.replace(/\[activities\]/, activities[randNumber(activities)]) text = text.replace(/\[activity\]/, activities[randNumber(activities)])
text = text.replace(/\[celebrities\]/, celebreties[randNumber(celebreties)]) text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)])
text = text.replace(/\[countries\]/, countries[randNumber(countries)]) text = text.replace(/\[country\]/, countries[randNumber(countries)])
text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]) text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)])
text = text.replace(/\[elements\]/, elements[randNumber(elements)]) text = text.replace(/\[elements\]/, elements[randNumber(elements)])
text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]) text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)])