1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 04:10:59 -05:00

Improve punishment log a bit better.

This commit is contained in:
toast-ts 2023-04-30 09:41:12 +10:00
parent 27ab44a2c3
commit 514d10d524
4 changed files with 13 additions and 13 deletions

View File

@ -155,7 +155,7 @@ export default class TClient extends Client {
}
async punish(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>, type: string){
if (!client.isStaff(interaction.member as Discord.GuildMember)) return client.youNeedRole(interaction, "dcmod");
console.log(client.logTime(), `[PunishmentLog] ${interaction.options.data.map(u=>u.user?.tag)} was used in /${interaction.commandName} for ${interaction.options.getString('reason') ?? 'Reason unspecified'}`);
console.log(client.logTime(), `[PunishmentLog] ${interaction.options.getMember('member')?.user.tag ? 'No user data' : interaction.options.getUser('member')?.tag} and ${interaction.options.getString('time') ?? 'No duration set'} was used in /${interaction.commandName} for ${interaction.options.getString('reason') ?? 'Reason unspecified'}`);
const time = interaction.options.getString('time') ?? undefined;
const reason = interaction.options.getString('reason') ?? 'Reason unspecified';

View File

@ -65,7 +65,8 @@
"bot_status": "1009753780188884992",
"logs": "548032776830582794",
"welcome": "621134751897616406",
"botcommands": "468888722210029588"
"botcommands": "468888722210029588",
"bankick_log": "1048341961901363352"
}
}
}

View File

@ -28,9 +28,8 @@ export default class punishments extends Schema {
createId = async()=>Math.max(...(await this._content.find({})).map(x=>x.id), 0) + 1;
async makeModlogEntry(punishment:Punishment){
// Format data into an embed
const channel = ['kick', 'ban'].includes(punishment.type) ? '1048341961901363352' : this.client.config.mainServer.channels.logs;
const embed = new this.client.embed()
.setTitle(`${punishment.type[0].toUpperCase() + punishment.type.slice(1)} | Case #${punishment._id}`)
const channel = ['kick', 'ban'].includes(punishment.type) ? this.client.config.mainServer.channels.bankick_log : this.client.config.mainServer.channels.logs;
const embed = new this.client.embed().setTitle(`${punishment.type[0].toUpperCase() + punishment.type.slice(1)} | Case #${punishment._id}`)
.addFields(
{name: '🔹 User', value: `<@${punishment.member}>\n\`${punishment.member}\``, inline: true},
{name: '🔹 Moderator', value: `<@${punishment.moderator}>\n\`${punishment.moderator}\``, inline: true},
@ -139,13 +138,12 @@ export default class punishments extends Schema {
await this._content.create(removePunishmentData);
await this.makeModlogEntry(removePunishmentData);
if (interaction) {
return interaction.reply({embeds:[new this.client.embed().setColor(this.client.config.embedColor)
if (interaction) return interaction.reply({embeds:[new this.client.embed().setColor(this.client.config.embedColor)
.setTitle(`Case #${removePunishmentData._id}: ${removePunishmentData.type[0].toUpperCase()+removePunishmentData.type.slice(1)}`)
.setDescription(`${User.tag}\n<@${User.id}>\n(\`${User.id}\`)`)
.addFields({name: 'Reason', value: reason},{name: 'Overwrites', value: `Case #${punishment.id}`})
]})
} else return `Successfully un${this.getTense(removePunishmentData.type.replace('un', ''))} ${User.tag} (\`${User.id}\`) for ${reason}`
]});
else return `Successfully un${this.getTense(removePunishmentData.type.replace('un', ''))} ${User.tag} (\`${User.id}\`) for ${reason}`
}
}
}

View File

@ -184,5 +184,6 @@ interface mainServerChannels {
bot_status: string,
logs: string,
welcome: string,
botcommands: string
botcommands: string,
bankick_log: string
}