@crypticat/cli
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -46,4 +46,6 @@ "use strict"; | ||
const client = new core_1.CrypticatClient(); | ||
client.on('message', (nick, content) => print(`${chalk_1.default.cyan.bold(nick)} ${content}`)); | ||
client.on('disconnect', () => { | ||
client.on('connect', (_, nick) => print(chalk_1.default.bold(`${nick !== null && nick !== void 0 ? nick : 'someone'} joined the room`))); | ||
client.on('disconnect', (_, nick) => print(chalk_1.default.bold(`${nick !== null && nick !== void 0 ? nick : 'someone'} left the room`))); | ||
client.on('message', (_, nick, content) => print(`${chalk_1.default.cyan.bold(nick !== null && nick !== void 0 ? nick : 'unnicked')} ${content}`)); | ||
client.on('close', () => { | ||
print(chalk_1.default.red('Connection lost!')); | ||
@@ -65,7 +67,7 @@ process.exit(); | ||
print(chalk_1.default.green('Connection established!')); | ||
client.setNick(config.get('nickname', null) + Math.random().toString(12).slice(2, 6)); | ||
print(''); | ||
yield joinRoom('lobby'); | ||
let nick = config.get('nickname', null); | ||
if (nick) { | ||
print(`Your nickname is currently ${chalk_1.default.cyan(nick)}`); | ||
if (client.getNick()) { | ||
print(`Your nickname is currently ${chalk_1.default.cyan(client.getNick())}`); | ||
} | ||
@@ -97,3 +99,3 @@ else { | ||
if (!args[0]) { | ||
nick = null; | ||
client.setNick(null); | ||
config.delete('nickname'); | ||
@@ -103,5 +105,5 @@ print(chalk_1.default.green('Reset nickname')); | ||
} | ||
nick = args.join(' '); | ||
config.set('nickname', nick); | ||
print(chalk_1.default.green(`Updated nickname to ${nick}`)); | ||
client.setNick(args.join(' ')); | ||
config.set('nickname', client.getNick()); | ||
print(chalk_1.default.green(`Updated nickname to ${client.getNick()}`)); | ||
break; | ||
@@ -112,5 +114,5 @@ } | ||
} | ||
client.sendMessage(nick !== null && nick !== void 0 ? nick : 'unnicked', message); | ||
client.sendMessage(message); | ||
} | ||
}); | ||
//# sourceMappingURL=client.js.map |
@@ -11,3 +11,3 @@ "use strict"; | ||
server.on('disconnect', (uid) => console.log(`${chalk_1.default.gray(uid.slice(0, 6))} disconnected`)); | ||
server.on('join', (uid, room) => console.log(`${chalk_1.default.gray(uid.slice(0, 6))} joined ${chalk_1.default.cyan(`#${room}`)}`)); | ||
server.on('join', (uid, room, nick) => console.log(`${chalk_1.default.gray(uid.slice(0, 6))} joined ${chalk_1.default.cyan(`#${room}`)} as ${chalk_1.default.cyan(nick !== null && nick !== void 0 ? nick : 'unnicked')}`)); | ||
server.on('dispatch', (from, to) => console.log(`${from.slice(0, 6)} ${chalk_1.default.gray('->')} ${to.slice(0, 6)}`)); | ||
@@ -14,0 +14,0 @@ exports.go = (port) => { |
{ | ||
"name": "@crypticat/cli", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Crypticat's command-line interface", | ||
@@ -26,6 +26,7 @@ "author": "Kognise <felix.mattick@gmail.com>", | ||
"tsc": "tsc -p tsconfig.build.json", | ||
"watch": "tsc --watch" | ||
"watch": "tsc --watch", | ||
"preversion": "yarn tsc" | ||
}, | ||
"dependencies": { | ||
"@crypticat/core": "^0.1.10", | ||
"@crypticat/core": "^0.2.3", | ||
"chalk": "^3.0.0", | ||
@@ -32,0 +33,0 @@ "conf": "^6.2.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
13594
149
+ Added@crypticat/core@0.2.13(transitive)
- Removed@crypticat/core@0.1.10(transitive)
Updated@crypticat/core@^0.2.3