🎨 Replace colors module with chalk module

This commit is contained in:
brunosimon
2017-12-26 14:29:00 +01:00
parent 494bd401b9
commit 73bc3e174a
8 changed files with 87 additions and 59 deletions
+7 -6
View File
@@ -1,5 +1,6 @@
const ids = require('./ids.js')
const robotNames = require('./assets/data/robot-names.json')
const chalk = require('chalk')
const HTMLEntities = require('html-entities')
class Chat
@@ -38,8 +39,8 @@ class Chat
// Debug
if(this.config.debug >= 1)
{
console.log('chat > socket'.green.bold + ' - ' + 'connection'.cyan + ' - ' + socket.id.cyan)
console.log('chat > user'.green.bold + ' - ' + 'create'.cyan + ' - ' + user.name.cyan)
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('connection')} - ${chalk.cyan(socket.id)}`)
console.log(`${chalk.green.bold('chat > user')} - ${chalk.cyan('create')} - ${chalk.cyan(user.name)}`)
}
// Send user infos
@@ -71,7 +72,7 @@ class Chat
// Debug
if(this.config.debug >= 1)
{
console.log('chat > socket'.green.bold + ' - ' + 'message'.cyan + ' - ' + user.name.cyan + ' - ' + data.text.cyan)
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('message')} - ${chalk.cyan(user.name)} - ${chalk.cyan(data.text)}`)
}
})
@@ -93,7 +94,7 @@ class Chat
// Debug
if(this.config.debug >= 1)
{
console.log('chat > socket'.green.bold + ' - ' + 'update_user'.cyan + ' - ' + (oldName + ' > ' + user.name).cyan)
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('update_user')} - ${chalk.cyan(oldName + ' > ' + user.name)}`)
}
})
@@ -106,14 +107,14 @@ class Chat
// Debug
if(this.config.debug >= 1)
{
console.log('chat > socket'.green.bold + ' - ' + 'alert'.cyan + ' - ' + user.name.cyan)
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('alert')} - ${chalk.cyan(user.name)}`)
}
})
// On disconnect
socket.on('disconnect', () =>
{
console.log('chat > socket'.green.bold + ' - ' + 'disconnect'.cyan + ' - ' + user.name.cyan)
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('disconnect')} - ${chalk.cyan(user.name)}`)
})
})
}