temp fix for "forEach" bug

This is a temporary fix for the "Cannot read properties of undefined (reading 'forEach')" bug. This will be fixed in a better way in v3.4.0
This commit is contained in:
Jasper
2023-04-30 12:11:31 +02:00
committed by GitHub
parent 739ad81f3f
commit ada5ea0c5d
+18 -16
View File
@@ -136,21 +136,23 @@ module.exports = () => {
* @type {String[]}
*/
const readonlyTicketadmin = currentTicketOptions.readonlyAdminroles
readonlyTicketadmin.forEach((role,index) => {
if (!config.adminRoles.includes(role) && !currentTicketOptions.adminroles.includes(role)){
try {
const adminrole = guild.roles.cache.find(r => r.id == role)
if (!adminrole) return
permissionsArray.push({
id:adminrole,
type:"role",
allow:[pfb.AddReactions,pfb.ViewChannel],
deny:[pfb.SendMessages,pfb.AttachFiles,pfb.EmbedLinks]
})
}catch{}
}
})
if (readonlyTicketadmin){
readonlyTicketadmin.forEach((role,index) => {
if (!config.adminRoles.includes(role) && !currentTicketOptions.adminroles.includes(role)){
try {
const adminrole = guild.roles.cache.find(r => r.id == role)
if (!adminrole) return
permissionsArray.push({
id:adminrole,
type:"role",
allow:[pfb.AddReactions,pfb.ViewChannel],
deny:[pfb.SendMessages,pfb.AttachFiles,pfb.EmbedLinks]
})
}catch{}
}
})
}
//add member role
if (config.system.memberRole && ![" ","0","false","null","undefined"].includes(config.system.memberRole)){
@@ -241,4 +243,4 @@ module.exports = () => {
}
}
})
}
}