Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for hasAdminRole falls through into rest of function. #8

Open
sharkmoos opened this issue Aug 20, 2023 · 0 comments · May be fixed by #9
Open

Check for hasAdminRole falls through into rest of function. #8

sharkmoos opened this issue Aug 20, 2023 · 0 comments · May be fixed by #9
Assignees

Comments

@sharkmoos
Copy link
Owner

Looks like, currently, a user using the command but failing the hasAdminRole check receives an error message, but the bot actually continues to process the message.

// I guess this is actually redundant because the channel defined above is currently an admin-only channel,
// but I'll leave it in, in case we want to change the channel in the future.
if !hasAdminRole(i.Member.Roles) {
if s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: fmt.Sprintf("You do not have the required role to use this command"),
},
}) != nil {
log.Printf("Interaction response failed: %v", err)
}
}

@sharkmoos sharkmoos self-assigned this Aug 20, 2023
@sharkmoos sharkmoos linked a pull request Aug 23, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant