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
Add Owner Only command flag #22
Comments
How would you know who the owner is? |
@diamondburned You can get it from application information. This should handle teams too. |
That's too niche. Having multiple arguments for one specific thing in the router wouldn't work. Ideally, you'd either get it from the API or the application implements it by itself. |
Or maybe add Owner IDs defining? |
That won't do, as I said above. |
I have an idea. |
Once #24 gets implemented, you should be able to do the following: const OwnerID = 694201337123123
func (cmds *Commands) Setup(sub *bot.Subcommand) {
// Add a middleware for all methods (*). The intake argument could also be
// an interface{}.
sub.AddMiddleware("*", func(c *gateway.MessageCreateEvent) error {
if c.Author.ID != OwnerID {
return bot.Break // silently break the chain
}
return nil // continue the chain
})
} |
O
flag should be added and commands that have this flag can be run only by the owner of bot.The text was updated successfully, but these errors were encountered: