2020-05-11 05:30:07 +07:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
)
|
|
|
|
|
2020-05-12 10:18:19 +07:00
|
|
|
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)
|
2020-05-12 10:18:19 +07:00
|
|
|
return false
|
2020-05-11 05:30:07 +07:00
|
|
|
}
|
2020-05-12 10:18:19 +07:00
|
|
|
return perm&discordgo.PermissionAdministrator != 0
|
2020-05-11 05:30:07 +07:00
|
|
|
}
|