For Floor Gang bot. Every command should interface with this library to authorize each user that uses an admin-related command. It does this by communicating to a process over RPC+HTTP. You should use this library to verify each guild member trying to execute a command. This is easy to do.
Make sure an instance of authserver is running on your local machine where the authclient can reach it.
package main
import auth "github.com/Floor-Gang/authclient"
func main() {
client := auth.GetClient("http://localhost:6969")
memberID := "1234"
// result will be an AuthResponse which includes two properties:
// IsAdmin (boolean): Whether or not they're allowed to us the command
// Role (string): The ID of the role that's enabling them.
result := client.Auth("member ID 1234")
if result.IsAdmin {
// do stuff...
} else {
// tell them they're not allowed to use the command
}
}
Don't allow execution of a given command, and certainly don't setup your own authentication process unless it's specialized to particular roles rather than the shared ones stored in the authserver
Report it here
Since this library is under a private repository knowledge yourself about getting packages in Go from private repositories.
Make sure your enviroment variable "GOPRIVATE" includes the following
export GOPRIVATE='github.com/floor-gang'
Finally run this to get the library
$ go get github.com/Floor-Gang/authclient@latest
X.Y
- X: A major change has happened, please update your code.
- Y: A patch was implemented.