🆕:Command File Changed ❌:All commands
Currently only Create command works
This commit is contained in:
parent
2486f57e2b
commit
f83a4231f1
7 changed files with 226 additions and 227 deletions
34
commands/create.ts
Normal file
34
commands/create.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { squirrel } from "../scripts/enums";
|
||||
import { newSquirrel, updateSquirrelFile } from "../scripts/functions";
|
||||
|
||||
module.exports = {
|
||||
name: 'create',
|
||||
description: "Create a squirrel, can only be used once",
|
||||
args: "**name** - the name of the created squirrel\n**race** - The race of the created squirrel, type !races for race options\n**class** - The class of the created squirrel, type !classes for class options",
|
||||
execute(msg, args) {
|
||||
if (args.length !== 3) {
|
||||
msg.reply(`Too many or too few parameters were entered. The format is "create name race class". You only get to choose your first name, don't write a last name.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
let newSquirrel: squirrel = squirrel(args[0], args[1], args[2]);
|
||||
|
||||
let incorrect: string = "";
|
||||
|
||||
if (newSquirrel.race === -1)
|
||||
incorrect += ` race as ${args[1]}`;
|
||||
if (newSquirrel.class === -1)
|
||||
incorrect += ` class as ${args[2]}`;
|
||||
|
||||
if (incorrect === "") {
|
||||
updateSquirrelFile(msg.author.id, newSquirrel);
|
||||
msg.reply(`Squirrel ${newSquirrel.name} has been created`);
|
||||
} else {
|
||||
msg.reply(`Some parameters were entered incorrectly. Remember the format is "create first_name race class". Your name can be whatever you want, but you have to choose from !race, and !class. You incorrectly entered:${incorrect}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function squirrel(name: string, race: string, classtype: string): squirrel {
|
||||
return newSquirrel(name, race, classtype);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue