From c4ddd6aebbb3e34312dd8502fad909823df7082e Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Fri, 30 Dec 2022 09:17:50 +1100 Subject: [PATCH] improve few events --- src/events/guildMemberAdd.ts | 2 +- src/events/guildMemberRemove.ts | 2 +- src/events/messageDelete.ts | 2 ++ src/events/messageUpdate.ts | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/events/guildMemberAdd.ts b/src/events/guildMemberAdd.ts index 9446a94..8af7ee4 100644 --- a/src/events/guildMemberAdd.ts +++ b/src/events/guildMemberAdd.ts @@ -29,7 +29,7 @@ export default { const embed1 = new client.embed().setColor(client.config.embedColorGreen).setTimestamp().setThumbnail(member.user.displayAvatarURL({size: 2048})).setTitle(`Member Joined: ${member.user.tag}`).setDescription(`<@${member.user.id}>\n\`${member.user.id}\``).setFooter({text: `Total members: ${index}${suffix}`}).addFields( {name: '🔹 Account Creation Date', value: `\n`}, - {name: '🔹 Invite Data:', value: usedInvite ? `Invite: \`${usedInvite.code}\`\nCreated by: **${usedInvite.inviter?.tag}**` : 'I couldn\'t find out how they joined!'} + {name: '🔹 Invite Data:', value: usedInvite ? `Invite: \`${usedInvite.code}\`\nCreated by: **${usedInvite.inviter?.tag}**` : 'No invite data could be found.'} ); (client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel).send({embeds: [embed1]}) } diff --git a/src/events/guildMemberRemove.ts b/src/events/guildMemberRemove.ts index e0de9fc..2a48246 100644 --- a/src/events/guildMemberRemove.ts +++ b/src/events/guildMemberRemove.ts @@ -8,7 +8,7 @@ export default { if (member.guild?.id != client.config.mainServer.id) return; const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setThumbnail(member.user.displayAvatarURL({size: 2048}) as string).setTitle(`Member Left: ${member.user.tag}`).setDescription(`<@${member.user.id}>\n\`${member.user.id}\``).addFields( {name: '🔹 Account Creation Date', value: `\n`}, - {name: '🔹 Join Date', value: `\n`}, + {name: '🔹 Server Join Date', value: `\n`}, {name: `🔹 Roles: ${member.roles.cache.size - 1}`, value: `${member.roles.cache.size > 1 ? member.roles.cache.filter((x)=>x.id !== member.guild.roles.everyone.id).sort((a,b)=>b.position - a.position).map(x=>x).join(member.roles.cache.size > 4 ? ' ' : '\n').slice(0,1024) : 'No roles'}`, inline: true}, {name: '🔹 Level messages', value: `${client.userLevels._content[member.user.id]?.messages.toLocaleString('en-US') || 0}`, inline: true} ); diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts index a4c6542..72e700d 100644 --- a/src/events/messageDelete.ts +++ b/src/events/messageDelete.ts @@ -5,9 +5,11 @@ export default { execute: async(client:TClient, msg:Discord.Message)=>{ if (!client.config.botSwitches.logs) return; const channel = client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel; + const disabledChannels = ['548032776830582794'] if (msg.guild?.id != client.config.mainServer.id) return; if (msg.partial) return; if (msg.author.bot) return; + if (disabledChannels) return; const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setAuthor({name: `Author: ${msg.author.tag} (${msg.author.id})`, iconURL: `${msg.author.displayAvatarURL()}`}).setTitle('Message deleted').setDescription(`<@${msg.author.id}>\n\`${msg.author.id}\``); if (msg.content.length != 0) embed.addFields({name: 'Content', value: `\`\`\`\n${msg.content.slice(0,1000)}\n\`\`\``}); embed.addFields( diff --git a/src/events/messageUpdate.ts b/src/events/messageUpdate.ts index d72c631..6aafdbd 100644 --- a/src/events/messageUpdate.ts +++ b/src/events/messageUpdate.ts @@ -4,12 +4,14 @@ export default { name: 'messageUpdate', execute: async(client:TClient, oldMsg:Discord.Message, newMsg:Discord.Message)=>{ if (!client.config.botSwitches.logs) return; + const disabledChannels = ['548032776830582794'] if (oldMsg.guild?.id != client.config.mainServer.id) return; if (oldMsg.author == null) return; if (oldMsg?.author.bot) return; if (oldMsg.partial) return; if (newMsg.partial) return; if (!newMsg.member) return; + if (disabledChannels) return; 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;