1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-26 11:45:37 -05:00

improve few events

This commit is contained in:
toast-ts 2022-12-30 09:17:50 +11:00
parent aacb93ca62
commit c4ddd6aebb
4 changed files with 6 additions and 2 deletions

View File

@ -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: `<t:${Math.round(member.user.createdTimestamp/1000)}>\n<t:${Math.round(member.user.createdTimestamp/1000)}:R>`},
{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]})
}

View File

@ -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: `<t:${Math.round(member.user.createdTimestamp/1000)}>\n<t:${Math.round(member.user.createdTimestamp/1000)}:R>`},
{name: '🔹 Join Date', value: `<t:${Math.round(member.joinedTimestamp/1000)}>\n<t:${Math.round(member.joinedTimestamp/1000)}:R>`},
{name: '🔹 Server Join Date', value: `<t:${Math.round(member.joinedTimestamp/1000)}>\n<t:${Math.round(member.joinedTimestamp/1000)}:R>`},
{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}
);

View File

@ -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(

View File

@ -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;