1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-09-29 08:20:59 -04:00

Some tweaks here and there

This commit is contained in:
toast-ts 2023-02-10 19:13:56 -08:00
parent 1df6004a32
commit 77a382b990
2 changed files with 5 additions and 5 deletions

View File

@ -2,10 +2,10 @@ import Discord from 'discord.js';
import TClient from '../client';
export default {
async run(client:TClient, messages:Discord.Collection<string, Discord.Message<boolean>>){
const channel = client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel;
if (!client.config.botSwitches.logs) return;
if ((client.guilds.cache.get('929807948748832798') as Discord.Guild)?.id != client.config.mainServer.id) return;
const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setTitle(`${messages.size} messages were purged`).setDescription(`\`\`\`${messages.map((msgs)=>`${msgs.member.displayName}: ${msgs.content}`).reverse().join('\n').slice(0,3900)}\`\`\``).addFields({name: 'Channel', value: `<#${(messages.first() as Discord.Message).channel.id}>`});
if (client.config.mainServer.id != '468835415093411861') return;
const channel = client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel;
const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setTitle(`${messages.size} messages were purged`).setDescription(`\`\`\`${messages.map((msgs)=>`${msgs.member.displayName}: ${msgs.content}`).reverse().join('\n').slice(0,3900)}\`\`\``).addFields({name: 'Channel', value: `<#${messages.first().channel.id}>`});
channel.send({embeds: [embed]})
}
}

View File

@ -90,7 +90,7 @@ export class punishments extends Database {
if (data.cancels) embed.addFields({name: '🔹 Overwrites', value: `This case overwrites Case #${cancels.id}\n\`${cancels.reason}\``});
// send embed in modlog channel
(this.client.channels.cache.get(channelId) as Discord.TextChannel).send({embeds: [embed]});
(this.client.channels.resolve(channelId) as Discord.TextChannel).send({embeds: [embed]});
};
getTense(type: string) { // Get past tense form of punishment type, grammar yes
switch (type) {
@ -141,7 +141,7 @@ export class punishments extends Database {
if (['ban', 'softban'].includes(type)) {
const banned = await guild.bans.fetch(User.id).catch(() => undefined);
if (!banned) {
punResult = await guild.bans.create(User.id, {reason: `${reason} | Case #${punData.id}`}).catch((err: Error) => err.message);
punResult = await guild.bans.create(User.id, {reason: `${reason} | Case #${punData.id}`, deleteMessageSeconds: 172800}).catch((err: Error) => err.message);
} else {
punResult = 'User is already banned.';
}