Milen/util/perm.go

15 lines
307 B
Go

2020-05-11 05:30:07 +07:00
package util
import (
"github.com/bwmarrin/discordgo"
)
func HasAdmin(dg *discordgo.Session, userID string, channelID string) bool {
2020-05-11 05:30:07 +07:00
perm, err := dg.UserChannelPermissions(userID, channelID)
if err != nil {
ReportError(dg, err)
return false
2020-05-11 05:30:07 +07:00
}
return perm&discordgo.PermissionAdministrator != 0
2020-05-11 05:30:07 +07:00
}