fix: trim more
This commit is contained in:
parent
97eef84e8c
commit
f24ec09f2a
@ -95,7 +95,7 @@ router.patch(
|
|||||||
version: Snowflake.generate(),
|
version: Snowflake.generate(),
|
||||||
};
|
};
|
||||||
|
|
||||||
await ApplicationCommand.update({ name: body.name }, commandForDb);
|
await ApplicationCommand.update({ name: body.name.trim() }, commandForDb);
|
||||||
res.send(commandForDb);
|
res.send(commandForDb);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -83,10 +83,10 @@ router.post(
|
|||||||
version: Snowflake.generate(),
|
version: Snowflake.generate(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, name: body.name } });
|
const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, name: body.name.trim() } });
|
||||||
|
|
||||||
if (commandExists) {
|
if (commandExists) {
|
||||||
await ApplicationCommand.update({ application_id: req.params.application_id, name: body.name }, commandForDb);
|
await ApplicationCommand.update({ application_id: req.params.application_id, name: body.name.trim() }, commandForDb);
|
||||||
} else {
|
} else {
|
||||||
commandForDb.id = Snowflake.generate(); // Have to be done that way so the id doesn't change
|
commandForDb.id = Snowflake.generate(); // Have to be done that way so the id doesn't change
|
||||||
await ApplicationCommand.save(commandForDb);
|
await ApplicationCommand.save(commandForDb);
|
||||||
@ -154,10 +154,10 @@ router.put(
|
|||||||
version: Snowflake.generate(),
|
version: Snowflake.generate(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, name: command.name } });
|
const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, name: command.name.trim() } });
|
||||||
|
|
||||||
if (commandExists) {
|
if (commandExists) {
|
||||||
await ApplicationCommand.update({ application_id: req.params.application_id, name: command.name }, commandForDb);
|
await ApplicationCommand.update({ application_id: req.params.application_id, name: command.name.trim() }, commandForDb);
|
||||||
} else {
|
} else {
|
||||||
commandForDb.id = Snowflake.generate(); // Have to be done that way so the id doesn't change
|
commandForDb.id = Snowflake.generate(); // Have to be done that way so the id doesn't change
|
||||||
await ApplicationCommand.save(commandForDb);
|
await ApplicationCommand.save(commandForDb);
|
||||||
|
|||||||
@ -113,7 +113,7 @@ router.patch(
|
|||||||
};
|
};
|
||||||
|
|
||||||
const commandExists = await ApplicationCommand.exists({
|
const commandExists = await ApplicationCommand.exists({
|
||||||
where: { application_id: req.params.application_id, guild_id: req.params.guild_id, id: req.params.command_id, name: body.name },
|
where: { application_id: req.params.application_id, guild_id: req.params.guild_id, id: req.params.command_id, name: body.name.trim() },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!commandExists) {
|
if (!commandExists) {
|
||||||
@ -121,7 +121,10 @@ router.patch(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ApplicationCommand.update({ application_id: req.params.application_id, guild_id: req.params.guild_id, id: req.params.command_id, name: body.name }, commandForDb);
|
await ApplicationCommand.update(
|
||||||
|
{ application_id: req.params.application_id, guild_id: req.params.guild_id, id: req.params.command_id, name: body.name.trim() },
|
||||||
|
commandForDb,
|
||||||
|
);
|
||||||
res.send(commandForDb);
|
res.send(commandForDb);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -107,10 +107,10 @@ router.post(
|
|||||||
version: Snowflake.generate(),
|
version: Snowflake.generate(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, guild_id: req.params.guild_id, name: body.name } });
|
const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, guild_id: req.params.guild_id, name: body.name.trim() } });
|
||||||
|
|
||||||
if (commandExists) {
|
if (commandExists) {
|
||||||
await ApplicationCommand.update({ application_id: req.params.application_id, guild_id: req.params.guild_id, name: body.name }, commandForDb);
|
await ApplicationCommand.update({ application_id: req.params.application_id, guild_id: req.params.guild_id, name: body.name.trim() }, commandForDb);
|
||||||
} else {
|
} else {
|
||||||
commandForDb.id = Snowflake.generate(); // Have to be done that way so the id doesn't change
|
commandForDb.id = Snowflake.generate(); // Have to be done that way so the id doesn't change
|
||||||
await ApplicationCommand.save(commandForDb);
|
await ApplicationCommand.save(commandForDb);
|
||||||
|
|||||||
Reference in New Issue
Block a user