2022-11-15 09:06:18 -05:00
import Discord , { ActionRowBuilder , ButtonBuilder } from 'discord.js' ;
2023-01-27 21:33:55 -05:00
import TClient from '../client' ;
2022-11-15 09:06:18 -05:00
export default {
2023-01-02 04:45:05 -05:00
async run ( client :TClient , oldMsg :Discord.Message , newMsg :Discord.Message ) {
2022-11-15 09:06:18 -05:00
if ( ! client . config . botSwitches . logs ) return ;
2023-01-01 20:09:03 -05:00
const disabledChannels = [
'548032776830582794' , '541677709487505408'
]
if (
oldMsg . guild ? . id != client . config . mainServer . id
|| oldMsg . author == null
|| oldMsg ? . author . bot
|| oldMsg . partial
|| newMsg . partial
|| ! newMsg . member
|| disabledChannels . includes ( newMsg . channelId )
) return ;
2022-11-15 09:06:18 -05:00
const msgarr = newMsg . content . toLowerCase ( ) . split ( ' ' ) ;
if ( client . bannedWords . _content . some ( ( word :string ) = > msgarr . includes ( word ) ) && ( ! client . isStaff ( newMsg . member ) ) ) newMsg . delete ( ) ;
if ( newMsg . content === oldMsg . content ) return ;
2022-11-17 12:58:19 -05:00
const embed = new client . embed ( ) . setColor ( client . config . embedColor ) . setTimestamp ( ) . setAuthor ( { name : ` Author: ${ oldMsg . author . tag } ( ${ oldMsg . author . id } ) ` , iconURL : ` ${ oldMsg . author . displayAvatarURL ( ) } ` } ) . setTitle ( 'Message edited' ) . setDescription ( ` <@ ${ oldMsg . author . id } > \ nOld content: \ n \` \` \` \ n ${ oldMsg . content } \ n \` \` \` \ nNew content: \ n \` \` \` \ n ${ newMsg . content } \` \` \` \ nChannel: <# ${ oldMsg . channelId } > ` ) ;
2022-11-15 09:06:18 -05:00
( client . channels . resolve ( client . config . mainServer . channels . logs ) as Discord . TextChannel ) . send ( { embeds : [ embed ] , components : [ new ActionRowBuilder < ButtonBuilder > ( ) . addComponents ( new ButtonBuilder ( ) . setStyle ( 5 ) . setURL ( ` ${ oldMsg . url } ` ) . setLabel ( 'Jump to message' ) ) ] } ) ;
}
2022-11-25 04:52:31 -05:00
}