const fs = require('fs')
const path = require('path')
const readline = require('readline')
const defaultLocale = require('../../src/config.js').bot.locale
const localeData = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'src', 'locales', `${defaultLocale}.json`)))

const obj = {}

function traverse (object, reference) {
  for (const key in object) {
    const value = object[key]
    if (typeof value === 'object') {
      reference[key] = {}
      traverse(value, reference[key])
    } else {
      reference[key] = ''
    }
  }
}

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.question('Type the locale to generate a template: ', name => {
  traverse(localeData, obj)
  const file = path.join(__dirname, '..', '..', 'src', 'locales', `${name}.json`)
  fs.writeFileSync(file, JSON.stringify(obj, null, 2))
  console.log(`Created at ${file}`)
  rl.close()
})

@@ -634,16 +634,129 @@
 ut%0A%7D);%0A%0A
+console.log('The locale name should by in the format of %5Cx1b%5B1mlanguage-region%5Cx1b%5B0m.')%0A%0Afunction prompt () %7B%0A  
 rl.quest
@@ -760,16 +760,18 @@
 estion('
+%5Cn
 Type the
@@ -815,16 +815,18 @@
 me =%3E %7B%0A
+  
   traver
@@ -845,16 +845,149 @@
 a, obj)%0A
+    if (name.includes('_')) %7B%0A      console.log('Invalid. Hyphens (-) must be used, not underscores.')%0A      return prompt()%0A    %7D%0A  
   const 
@@ -1060,16 +1060,18 @@
 .json%60)%0A
+  
   fs.wri
@@ -1117,16 +1117,18 @@
 ll, 2))%0A
+  
   consol
@@ -1155,16 +1155,18 @@
 file%7D%60)%0A
+  
   rl.clo
@@ -1174,7 +1174,21 @@
 e()%0A
+  
 %7D)%0A
+%7D%0A%0Aprompt()%0A

Update locales create script