2020-05-11 05:30:07 +07:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/bwmarrin/discordgo"
|
2020-05-11 06:43:55 +07:00
|
|
|
|
|
|
|
"gitea.teamortix.com/chanbakjsd/Milen/humanify"
|
2020-05-11 05:30:07 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
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 {
|
2020-05-11 06:43:55 +07:00
|
|
|
SendCheckError(dg, channelID, humanify.Eng.NoAdmin)
|
2020-05-11 05:30:07 +07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
hasAdmin()
|
|
|
|
}
|