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[]} * @type {String[]}
*/ */
const readonlyTicketadmin = currentTicketOptions.readonlyAdminroles const readonlyTicketadmin = currentTicketOptions.readonlyAdminroles
readonlyTicketadmin.forEach((role,index) => { if (readonlyTicketadmin){
if (!config.adminRoles.includes(role) && !currentTicketOptions.adminroles.includes(role)){ readonlyTicketadmin.forEach((role,index) => {
try { if (!config.adminRoles.includes(role) && !currentTicketOptions.adminroles.includes(role)){
const adminrole = guild.roles.cache.find(r => r.id == role) try {
if (!adminrole) return const adminrole = guild.roles.cache.find(r => r.id == role)
if (!adminrole) return
permissionsArray.push({
id:adminrole, permissionsArray.push({
type:"role", id:adminrole,
allow:[pfb.AddReactions,pfb.ViewChannel], type:"role",
deny:[pfb.SendMessages,pfb.AttachFiles,pfb.EmbedLinks] allow:[pfb.AddReactions,pfb.ViewChannel],
}) deny:[pfb.SendMessages,pfb.AttachFiles,pfb.EmbedLinks]
}catch{} })
} }catch{}
}) }
})
}
//add member role //add member role
if (config.system.memberRole && ![" ","0","false","null","undefined"].includes(config.system.memberRole)){ if (config.system.memberRole && ![" ","0","false","null","undefined"].includes(config.system.memberRole)){
@@ -241,4 +243,4 @@ module.exports = () => {
} }
} }
}) })
} }