Change parsing to not crash if invalid
This commit is contained in:
parent
55bd7ec5c7
commit
e428be19bd
3 changed files with 27 additions and 3 deletions
24
ormconfig.json.dev.template
Normal file
24
ormconfig.json.dev.template
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"type": "mysql",
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 3306,
|
||||||
|
"username": "dev",
|
||||||
|
"password": "dev",
|
||||||
|
"database": "vylbot",
|
||||||
|
"synchronize": true,
|
||||||
|
"logging": false,
|
||||||
|
"entities": [
|
||||||
|
"dist/entity/**/*.js"
|
||||||
|
],
|
||||||
|
"migrations": [
|
||||||
|
"dist/migration/**/*.js"
|
||||||
|
],
|
||||||
|
"subscribers": [
|
||||||
|
"dist/subscriber/**/*.js"
|
||||||
|
],
|
||||||
|
"cli": {
|
||||||
|
"entitiesDir": "dist/entity",
|
||||||
|
"migrationsDir": "dist/migration",
|
||||||
|
"subscribersDir": "dist/subscriber"
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
"username": "dev",
|
"username": "dev",
|
||||||
"password": "dev",
|
"password": "dev",
|
||||||
"database": "vylbot",
|
"database": "vylbot",
|
||||||
"synchronize": true,
|
"synchronize": false,
|
||||||
"logging": false,
|
"logging": false,
|
||||||
"entities": [
|
"entities": [
|
||||||
"dist/entity/**/*.js"
|
"dist/entity/**/*.js"
|
||||||
|
|
|
@ -108,7 +108,7 @@ export default class Lobby extends Command {
|
||||||
private async AddLobbyConfig(context: ICommandContext) {
|
private async AddLobbyConfig(context: ICommandContext) {
|
||||||
const channel = context.message.guild!.channels.cache.find(x => x.name == context.args[2]);
|
const channel = context.message.guild!.channels.cache.find(x => x.name == context.args[2]);
|
||||||
const role = context.message.guild!.roles.cache.find(x => x.name == context.args[3]);
|
const role = context.message.guild!.roles.cache.find(x => x.name == context.args[3]);
|
||||||
const cooldown = context.args[4] || "30";
|
const cooldown = Number(context.args[4]) || 30;
|
||||||
const gameName = context.args.splice(5).join(" ");
|
const gameName = context.args.splice(5).join(" ");
|
||||||
|
|
||||||
if (!channel || !role) {
|
if (!channel || !role) {
|
||||||
|
@ -116,7 +116,7 @@ export default class Lobby extends Command {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const entity = new eLobby(channel.id, role.id, Number.parseInt(cooldown), gameName);
|
const entity = new eLobby(channel.id, role.id, cooldown, gameName);
|
||||||
await entity.Save(eLobby, entity);
|
await entity.Save(eLobby, entity);
|
||||||
|
|
||||||
const embed = new PublicEmbed(context, "", "Added new lobby channel");
|
const embed = new PublicEmbed(context, "", "Added new lobby channel");
|
||||||
|
|
Loading…
Reference in a new issue