Test pointer panic
This commit is contained in:
parent
3eb47eda9c
commit
ecbe2e958f
36
utils.go
36
utils.go
@ -24,15 +24,15 @@ func CheckPermissions(session *discordgo.Session, member discordgo.Member, chann
|
||||
return true // If no permissions are required then just return true
|
||||
}
|
||||
|
||||
for _, overwrite := range channel.PermissionOverwrites {
|
||||
if overwrite.ID == member.User.ID {
|
||||
if overwrite.Allow&int(perms) != 0 {
|
||||
return true // If the channel has an overwrite for the user then true
|
||||
} else if overwrite.Deny&int(perms) != 0 {
|
||||
return false // If there is an explicit deny then false
|
||||
}
|
||||
}
|
||||
}
|
||||
//for _, overwrite := range channel.PermissionOverwrites {
|
||||
// if overwrite.ID == member.User.ID {
|
||||
// if overwrite.Allow & int(perms) != 0 {
|
||||
// return true // If the channel has an overwrite for the user then true
|
||||
// } else if overwrite.Deny & int(perms) != 0 {
|
||||
// return false // If there is an explicit deny then false
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
for _, roleID := range member.Roles {
|
||||
role, err := session.State.Role(member.GuildID, roleID)
|
||||
@ -40,15 +40,15 @@ func CheckPermissions(session *discordgo.Session, member discordgo.Member, chann
|
||||
return false // There is something wrong with the role, default to false
|
||||
}
|
||||
|
||||
for _, overwrite := range channel.PermissionOverwrites {
|
||||
if overwrite.ID == roleID {
|
||||
if overwrite.Allow&int(perms) != 0 {
|
||||
return true // If the channel has an overwrite for the role then true
|
||||
} else if overwrite.Deny&int(perms) != 0 {
|
||||
return false // If there is an explicit deny then false
|
||||
}
|
||||
}
|
||||
}
|
||||
//for _, overwrite := range channel.PermissionOverwrites {
|
||||
// if overwrite.ID == roleID {
|
||||
// if overwrite.Allow & int(perms) != 0 {
|
||||
// return true // If the channel has an overwrite for the role then true
|
||||
// } else if overwrite.Deny & int(perms) != 0 {
|
||||
// return false // If there is an explicit deny then false
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if role.Permissions&int(PermissionAdministrator) != 0 {
|
||||
return true // If they are an administrator then they automatically have all permissions
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user