diff --git a/package.json b/package.json index a5dc558..6f8ffef 100644 --- a/package.json +++ b/package.json @@ -28,14 +28,14 @@ "discord.js": "14.8.0", "moment": "2.29.4", "ms": "2.1.3", - "mongoose": "7.0.1", + "mongoose": "7.0.2", "systeminformation": "5.17.12", "@octokit/rest": "19.0.7", - "typescript": "4.9.5", + "typescript": "5.0.2", "xml-js": "1.6.11" }, "devDependencies": { - "@types/node": "18.15.0", + "@types/node": "18.15.3", "ts-node": "10.9.1" } } diff --git a/src/commands/case.ts b/src/commands/case.ts index 0cb3d12..91e087f 100644 --- a/src/commands/case.ts +++ b/src/commands/case.ts @@ -8,7 +8,8 @@ export default { update: async()=>{ const reason = interaction.options.getString('reason'); await client.punishments._content.findByIdAndUpdate(caseId, {reason}); - await interaction.reply({embeds: [new client.embed().setColor(client.config.embedColorGreen).setTitle('Case updated').setDescription(`Case #${caseId} has been successfully updated with new reason:\n\`${reason}\``)]}) + if (await client.punishments._content.findById(caseId)) await interaction.reply({embeds: [new client.embed().setColor(client.config.embedColorGreen).setTitle('Case updated').setDescription(`Case #${caseId} has been successfully updated with new reason:\n\`${reason}\``)]}); + else interaction.reply({embeds: [new client.embed().setColor(client.config.embedColorRed).setTitle('Case not updated').setDescription(`Case #${caseId} is not stored on database, not updating the reason.`)]}); }, view: async()=>{ const punishment = await client.punishments._content.findById(caseId); diff --git a/src/models/punishments.ts b/src/models/punishments.ts index eb53b27..5f6ffc7 100644 --- a/src/models/punishments.ts +++ b/src/models/punishments.ts @@ -45,7 +45,7 @@ export default class punishments extends Schema { } // Send it off to specific Discord channel. (this.client.channels.cache.get(channel) as Discord.TextChannel).send({embeds:[embed]}); - }// hi tae --- hi --- hru? + }// hi tae --- hi --- hru? --- no answer ok getTense(type:string){// Get past tense form of punishment type, grammar yes return { ban: 'banned', @@ -146,7 +146,7 @@ export default class punishments extends Schema { .setDescription(`${User.tag}\n<@${User.id}>\n(\`${User.id}\`)`) .addFields({name: 'Reason', value: reason},{name: 'Overwrites', value: `Case #${punishment.id}`}) ]}) - } else return `Successfully ${this.getTense(removePunishmentData.type)} ${User.tag} (\`${User.id}\`) for ${reason}` + } else return `Successfully un${this.getTense(removePunishmentData.type.replace('un', ''))} ${User.tag} (\`${User.id}\`) for ${reason}` } } }