1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-27 20:35:38 -05:00

Update packages and improved case update a bit better.

This commit is contained in:
toast-ts 2023-03-17 09:18:42 +11:00
parent be84089fb3
commit 163fc9de1d
3 changed files with 7 additions and 6 deletions

View File

@ -28,14 +28,14 @@
"discord.js": "14.8.0", "discord.js": "14.8.0",
"moment": "2.29.4", "moment": "2.29.4",
"ms": "2.1.3", "ms": "2.1.3",
"mongoose": "7.0.1", "mongoose": "7.0.2",
"systeminformation": "5.17.12", "systeminformation": "5.17.12",
"@octokit/rest": "19.0.7", "@octokit/rest": "19.0.7",
"typescript": "4.9.5", "typescript": "5.0.2",
"xml-js": "1.6.11" "xml-js": "1.6.11"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "18.15.0", "@types/node": "18.15.3",
"ts-node": "10.9.1" "ts-node": "10.9.1"
} }
} }

View File

@ -8,7 +8,8 @@ export default {
update: async()=>{ update: async()=>{
const reason = interaction.options.getString('reason'); const reason = interaction.options.getString('reason');
await client.punishments._content.findByIdAndUpdate(caseId, {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()=>{ view: async()=>{
const punishment = await client.punishments._content.findById(caseId); const punishment = await client.punishments._content.findById(caseId);

View File

@ -45,7 +45,7 @@ export default class punishments extends Schema {
} }
// Send it off to specific Discord channel. // Send it off to specific Discord channel.
(this.client.channels.cache.get(channel) as Discord.TextChannel).send({embeds:[embed]}); (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 getTense(type:string){// Get past tense form of punishment type, grammar yes
return { return {
ban: 'banned', ban: 'banned',
@ -146,7 +146,7 @@ export default class punishments extends Schema {
.setDescription(`${User.tag}\n<@${User.id}>\n(\`${User.id}\`)`) .setDescription(`${User.tag}\n<@${User.id}>\n(\`${User.id}\`)`)
.addFields({name: 'Reason', value: reason},{name: 'Overwrites', value: `Case #${punishment.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}`
} }
} }
} }