View/Edit: Add option to direct edit from character views

This commit is contained in:
2022-09-18 01:21:10 +02:00
parent 60f4c51353
commit 0afedc86e5
2 changed files with 4 additions and 4 deletions

View File

@@ -31,15 +31,15 @@ module.exports = {
.setRequired(false)
),
permissionLevel: 2,
async execute(interaction) {
async execute(interaction, type=undefined, id=undefined) {
await interaction.deferReply();
let user = await UserUtils.getUserByDiscordId(interaction.member.id);
let options = [];
let record;
switch (interaction.options.getString("type")) {
switch (interaction.options?.getString("type") ?? type) {
case "character":
record = await Character.findByPk(interaction.options.getString("id"), { include: Band });
record = await Character.findByPk(interaction.options?.getString("id") ?? id, { include: Band });
if (!record) {
interaction.editReply({ content: "Character not found" });
return;