1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 16:30:58 -05:00

Compare commits

..

2 Commits

Author SHA1 Message Date
AnxietyisReal
6912392130 Refactor role conflict logic in interactionCreate.ts 2023-12-27 00:36:48 +11:00
AnxietyisReal
b047cc4ee0 Fix case evasion check for expired value 2023-12-26 22:41:39 +11:00
2 changed files with 5 additions and 5 deletions

View File

@ -31,10 +31,10 @@ export default class InteractionCreate {
const RoleID = interaction.customId.replace('reaction-',''); const RoleID = interaction.customId.replace('reaction-','');
let roleConflictMsg = 'Cannot have both roles! - Button Role'; let roleConflictMsg = 'Cannot have both roles! - Button Role';
const WestFarm = '1149139369433776269'; const MFFarm1 = '1149139369433776269';
const EastFarm = '1149139583729160325'; const MFFarm2 = '1149139583729160325';
if (interaction.member.roles.cache.has(WestFarm) && RoleID === EastFarm) interaction.member.roles.set([EastFarm], roleConflictMsg); if (interaction.member.roles.cache.has(MFFarm1) && RoleID === MFFarm2) interaction.member.roles.remove(MFFarm1, roleConflictMsg);
else if (interaction.member.roles.cache.has(EastFarm) && RoleID === WestFarm) interaction.member.roles.set([WestFarm], roleConflictMsg); else if (interaction.member.roles.cache.has(MFFarm2) && RoleID === MFFarm1) interaction.member.roles.remove(MFFarm2, roleConflictMsg);
if (interaction.member.roles.cache.has(RoleID)) interaction.member.roles.remove(RoleID, 'Button Role').then(()=>interaction.reply({content: `You have been removed from <@&${RoleID}>`, ephemeral: true})); if (interaction.member.roles.cache.has(RoleID)) interaction.member.roles.remove(RoleID, 'Button Role').then(()=>interaction.reply({content: `You have been removed from <@&${RoleID}>`, ephemeral: true}));
else interaction.member.roles.add(RoleID, 'Button Role').then(()=>interaction.reply({content: `You have been added to <@&${RoleID}>`, ephemeral: true})); else interaction.member.roles.add(RoleID, 'Button Role').then(()=>interaction.reply({content: `You have been added to <@&${RoleID}>`, ephemeral: true}));

View File

@ -114,7 +114,7 @@ export class PunishmentsSvc {
return Math.max(...result.map((x:Punishment)=>x.case_id), 0) + 1; return Math.max(...result.map((x:Punishment)=>x.case_id), 0) + 1;
} }
async caseEvasionCheck(member:Discord.GuildMember) { async caseEvasionCheck(member:Discord.GuildMember) {
if (await this.model.findOne({where: {member: member.id, type: 'mute', expired: undefined}})) { if (await this.model.findOne({where: {member: member.id, type: 'mute', expired: null}})) {
(this.client.channels.cache.get(this.client.config.dcServer.channels.dcmod_chat) as Discord.TextChannel).send({embeds: [new this.client.embed().setColor(this.client.config.embedColorYellow).setTitle('Case evasion detected').setDescription(MessageTool.concatMessage( (this.client.channels.cache.get(this.client.config.dcServer.channels.dcmod_chat) as Discord.TextChannel).send({embeds: [new this.client.embed().setColor(this.client.config.embedColorYellow).setTitle('Case evasion detected').setDescription(MessageTool.concatMessage(
`**${member.user.username}** (\`${member.user.id}\`) has been detected for case evasion.`, `**${member.user.username}** (\`${member.user.id}\`) has been detected for case evasion.`,
'Timeout has been automatically added. (25 days)' 'Timeout has been automatically added. (25 days)'