Skip to content

Commit

Permalink
Change message on banned user join
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaUrsa committed Jan 12, 2024
1 parent 4f5fe58 commit 1bf0a32
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/discord/events/guildMemberAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,6 @@ export const guildMemberAdd: GuildMemberAddEvent = {
// );
// }

let modThread = null as ThreadChannel | null;
let modThreadMessage = `**${member.displayName} has joined the guild!**`;
let emoji = 'πŸ‘‹';

if (trustScoreData.trustScore < guildData.trust_score_limit) {
modThreadMessage = `**${member.displayName} has joined the guild, their account is untrusted!** <@&${guildData.role_moderator}>`;
emoji = 'πŸ‘€';
}

const bannedTest = await Promise.all(discordClient.guilds.cache.map(async guild => {
// log.debug(F, `Checking guild: ${guild.name}`);
const guildPerms = await checkGuildPermissions(guild, [
Expand Down Expand Up @@ -143,6 +134,20 @@ export const guildMemberAdd: GuildMemberAddEvent = {
// count how many 'banned' appear in the array
const bannedGuilds = bannedTest.filter(item => item) as GuildBan[];

let modThread = null as ThreadChannel | null;
let modThreadMessage = `**${member.displayName} has joined the guild!**`;
let emoji = 'πŸ‘‹';

if (trustScoreData.trustScore < guildData.trust_score_limit) {
modThreadMessage = `**${member.displayName} has joined the guild, their account is untrusted!** <@&${guildData.role_moderator}>`;
emoji = 'πŸ‘€';
}

if (bannedGuilds.length > 0) {
modThreadMessage = `**${member.displayName} has joined the guild, they are banned on ${bannedGuilds.length} other guilds!** <@&${guildData.role_moderator}>`;
emoji = 'πŸ‘€';
}

if (targetData.mod_thread_id || trustScoreData.trustScore < guildData.trust_score_limit || bannedGuilds.length > 0) {
log.debug(F, `Mod thread id exists: ${targetData.mod_thread_id}`);
// If the mod thread already exists, then they have previous reports, so we should try to update that thread
Expand Down

0 comments on commit 1bf0a32

Please sign in to comment.