UNPKG

801 BJavaScriptView Raw
1exports.command = {
2 name: "rntalker",
3 autoload: true,
4 unloadable: true,
5 min_rank: 10,
6 display: "renames the talker!",
7 help: ".rntalker <new-name> will change this talker name to <new-name>.",
8 usage: ".rntalker <new-name>",
9 weigth: 0,
10
11 // Function to execute the command
12 execute: function(socket, command, command_access) {
13 var chalk = require('chalk');
14 name = command.split(' ').slice(0).join(" "); // for now, names can have spaces
15 if ((typeof name) !== 'string' || name.length === 0) {
16 socket.write(chalk.yellow(":: ") + "You better type .help rntalker !\r\n");
17 return;
18 }
19 command_access.getUniverse().name = name;
20 command_access.saveUniverse();
21 command_access.reloadTalkerName();
22 socket.write(chalk.green(":: This talker is now " + chalk.bold(name) + ".\r\n"));
23 }
24}