Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions src/processes/antiraidListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ export const antiraidListener: ProcessInterface = {
const mentions = new Map()
const mutedRole = config.roleIDs.muted

// TODO: fix staffRole to mention properly, cannot be string
// NOTE: Pull from config, same role is achieved
const staffRole = config.roleIDs.staff
// const staffRole = 662405675107876864

// TODO: escape check if user is senior
// NOTE: Get role from config
const seniorRole = config.roleIDs.senior

Expand All @@ -34,25 +32,28 @@ export const antiraidListener: ProcessInterface = {
const userRoles = message.member.roles.cache

// Staff role is not used as of now
// const staff = userRoles.find(role => role.id === staffRole) != undefined
const staff =
userRoles.find(role => role.id === staffRole) != undefined
const senior =
userRoles.find(role => role.id === seniorRole) != undefined

// TODO: Check if they are not staff
// NOTE: Cant combine the two roles else theres weird operator logic
if (!senior) {
const {
users: { size: mentionedUsers },
roles: { size: mentionedRoles }
} = message.mentions

if (
mentionedRoles > 1 ||
mentionedUsers > 2 ||
mentionedUsers + mentionedRoles > 2
) {
lastKnownTimestamp
? checkOffender(message, lastKnownTimestamp)
: addOffenderToList(message)
if (!staff) {
const {
users: { size: mentionedUsers },
roles: { size: mentionedRoles }
} = message.mentions

if (
mentionedRoles > 1 ||
mentionedUsers > 2 ||
mentionedUsers + mentionedRoles > 2
) {
lastKnownTimestamp
? checkOffender(message, lastKnownTimestamp)
: addOffenderToList(message)
}
}
}
})
Expand All @@ -73,6 +74,8 @@ export const antiraidListener: ProcessInterface = {
const triggerAntiraid = async message => {
await message.delete()
message.member.roles.add(mutedRole)
// NOTE: This worked in development, should work in production
// TODO: Send message to #mod-log
message.channel.send(
`<@${message.author.id}> messed with the honk, so he got the bonk. (<@&${staffRole}>)`
)
Expand Down