19 lines
426 B
Go
19 lines
426 B
Go
|
package util
|
||
|
|
||
|
import (
|
||
|
"github.com/bwmarrin/discordgo"
|
||
|
)
|
||
|
|
||
|
func RequireAdmin(dg *discordgo.Session, userID string, channelID string, hasAdmin func()) {
|
||
|
perm, err := dg.UserChannelPermissions(userID, channelID)
|
||
|
if err != nil {
|
||
|
ReportError(dg, err)
|
||
|
return
|
||
|
}
|
||
|
if perm&discordgo.PermissionAdministrator == 0 {
|
||
|
SendCheckError(dg, channelID, "❌ You do not have permission to use this command.")
|
||
|
return
|
||
|
}
|
||
|
hasAdmin()
|
||
|
}
|